Created
May 21, 2015 01:43
-
-
Save dkuebric/59cdd9dff813c0cb468e to your computer and use it in GitHub Desktop.
Java API Example 2: Starting a trace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample for a trace in the queue consumer | |
TraceEvent event = Trace.startTrace("BackendWorkerName"); | |
// Because TraceView's UI like web applications, we'll use HTTP server KV pairs to leverage the UI fully | |
// source: https://docs.appneta.com/extending-traceview-customizing | |
event.addInfo("HTTP-Host", QUEUE_WORKER_HOSTNAME); | |
event.addInfo("URL", QUEUE_WORKER_HOSTNAME + "/" + TASK_NAME); // example for if there is a specific task type you'd like to segment on | |
// optional: use other KVs Controller, Action, Status, and Method to convey other data for the UI | |
event.report(); | |
// DO THE WORK | |
Trace.endTrace("BackendWorkerName"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment