Skip to content

balanced/petitioners

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Petitioners

Build Status Latest Version Downloads Supported Python versions License

Adds tracing to requests generated by Flask apps.

@petitioners.register_flask_app('X-Request-Trace', 'Trace-')
class FlaskApp(flask.Flask):
    pass

app = FlaskApp('name')

# or if you prefer not to use a decorator
petitioners.Petitioner.register(app)

Requests to app will now generate response with headers tagged like

X-Request-Trace: Trace-123123

If this header already exists then it will be appended to like

X-Request-Trace: Trace-123123,Trace-123432

The current trace value can be accessed from app via the petitioners property

>>> import flask
>>> import petitioners
>>> app = flask.Flask('name')
>>> petitioners.Petitioner.register(app)
>>> app.test_request_context().push()
>>> print flask.current_app.petitioners
<Petitioner (<Flask 'name'>)X-Petitioners=[u'OHM-c92bffaf1b27497aad73a1cb02b22059']>

About

Flask request tracing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages