Skip to content

Instantly share code, notes, and snippets.

@adam-hert
Last active September 26, 2016 19:20
Show Gist options
  • Save adam-hert/eebd3b31a2c432a84333a3b49cf50ce1 to your computer and use it in GitHub Desktop.
Save adam-hert/eebd3b31a2c432a84333a3b49cf50ce1 to your computer and use it in GitHub Desktop.
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
//import the tracelytics-api.jar (/usr/local/tracelytics/tracelytics-api.jar)
import com.tracelytics.api.ext.*;
public class process extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
Thread.sleep(500);
} catch(InterruptedException ex){
Thread.currentThread().interrupt();
}
//This uses the trace API to create a custom layer
TraceEvent event = Trace.createEntryEvent("Custom_Middle_Layer");
event.report();
//Basic hello world java stuff
PrintWriter out = response.getWriter();
out.println("Hello World");
try {
Thread.sleep(200);
} catch(InterruptedException ex){
Thread.currentThread().interrupt();
}
//Close off the custom layer with an exit event
TraceEvent new_event = Trace.createExitEvent("Custom_Middle_Layer");
new_event.report();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment