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, excludelist_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 Distribution
Built Distribution
Close
Hashes for opencensus-ext-flask-0.7.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a7f88211c656527ca6f9e89008063e4f5effa7523a8d3ec3f7a3bde8b6262fa |
|
MD5 | 4b63b040913dc76407fc8bffdaf68702 |
|
BLAKE2b-256 | ffbe9b7db75b57a8ade159a6b99e339b25b61c6dee9c0ff45621fcdf94307dc9 |
Close
Hashes for opencensus_ext_flask-0.7.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff03ff2039d0cfbf6ebf61b2100951972972391fdaa734859655400b8f9a1f95 |
|
MD5 | 96e4d002a5808291037dd4e61b14a125 |
|
BLAKE2b-256 | a8a00d3a32e553b37e87ceab1887be3cf849a49f121492f2800c83d941d8b017 |