OpenCensus Flask Integration
Project description
Installation
pip install opencensus-ext-flask
Usage
from flask import Flask
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
app = Flask(__name__)
middleware = FlaskMiddleware(app, blacklist_paths=['_ah/health'])
@app.route('/')
def hello():
return 'Hello World!'
if __name__ == '__main__':
import logging
logger = logging.getLogger('werkzeug')
logger.setLevel(logging.ERROR)
app.run(host='localhost', port=8080, threaded=True)
Additional configuration can be provided, please read Customization for a complete reference.
app.config['OPENCENSUS'] = {
'TRACE': {
'SAMPLER': 'opencensus.trace.samplers.ProbabilitySampler(rate=1)',
'EXPORTER': '''opencensus.ext.ocagent.trace_exporter.TraceExporter(
service_name='foobar',
)''',
}
}
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for opencensus_ext_flask-0.3.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3422c242211590bebdbe64c9d4e97d905f0c88f2f5874935148a8a8db866e21 |
|
MD5 | 51b09976e3956d72f40cc444cb76c6ea |
|
BLAKE2b-256 | 33987486b722facbcc16f2054fbfa4f4bbbb581fa0f4a31d42903a4bb96a49b5 |