Created
May 13, 2013 18:49
-
-
Save dkuebric/5570492 to your computer and use it in GitHub Desktop.
starting tracing in python code
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
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