Skip to content

Instantly share code, notes, and snippets.

@dkuebric
Created May 13, 2013 18:49
Show Gist options
  • Save dkuebric/5570492 to your computer and use it in GitHub Desktop.
Save dkuebric/5570492 to your computer and use it in GitHub Desktop.
starting tracing in python code
import oboe
from oboeware import loader
# load monkey-patched instrumentation for supported modules
loader.load_inst_modules()
# say this is the entry point for your mod_python code
def handle_request(headers, **other_stuff):
# start a trace based on incoming X-Trace HTTP header from Apache/nginx if available
oboe.start_trace('mod_python', xtr=headers['X-Trace'])
...
http_result = do_things()
...
# end the python trace and save the modified X-Trace value in the return HTTP headers
return_headers['X-Trace'] = oboe.end_trace('mod_python')
# however your webserver normally returns info
return (http_result, return_headers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment