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.8.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5196a8f73b3ab63b1bab1165be4b60dabd4e3085d3fc00473380ad2c2d73b39 |
|
MD5 | 8a98d752322dab232959276d8caf9a8f |
|
BLAKE2b-256 | 329e283c580c60942f003332fc733ae5e65e0839c22d10f39d738c1f8f31170a |
Close
Hashes for opencensus_ext_flask-0.8.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 011ac26d4aa1ddf84fd1b247123d610eec065a52de8ad057d945f01513182950 |
|
MD5 | 04d7b749d8726ea8233932155459da6b |
|
BLAKE2b-256 | 9aef40f7d9b935bf72ceea40bb68546d0c048b34ae10b4a835822a7a7d06bbb6 |