Skip to content

Instantly share code, notes, and snippets.

@davemiller
Created November 20, 2013 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davemiller/7555802 to your computer and use it in GitHub Desktop.
Save davemiller/7555802 to your computer and use it in GitHub Desktop.
public static class TracingHandler extends SimpleChannelUpstreamHandler {
private Tagging tagging;
public TracingHandler(Tagging tagging) {
this.tagging = tagging;
}
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
HttpRequest httpRequest = (HttpRequest)e.getMessage();
String tagString = httpRequest.getHeader(DT_HEADER);
if(tagString !=null && tagging.isTagValid(tagString)) {
tagging.setTagFromString(tagString);
tagging.startServerPurePath();
}
//code you want to trace goes here
tagging.endServerPurePath(); //this could probably go in the writeComplete or channelClosed
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment