Skip to content

Instantly share code, notes, and snippets.

@dkuebric
Created May 21, 2015 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkuebric/59cdd9dff813c0cb468e to your computer and use it in GitHub Desktop.
Save dkuebric/59cdd9dff813c0cb468e to your computer and use it in GitHub Desktop.
Java API Example 2: Starting a trace
// 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