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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86519517229f8a1c316f3d7d776c88b7de1292a3b754c9f8f3e96adedbcb0af2 |
|
MD5 | 8028c3e3440a03d2e4838fb3b87c7fb3 |
|
BLAKE2b-256 | 0d3567896ab99ca0b415253ddf1b7926d3c058e8758db49087440dbffdb77e55 |
Close
Hashes for opencensus_ext_flask-0.7.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62daa782d24d89e8e9c0139db76fa971768db574e7d0099e8f73f7d93065c8f9 |
|
MD5 | cf0f8d05ea756a80c297ea99350b8991 |
|
BLAKE2b-256 | dbe4abd018c3bfb99d2a170e85b3e7aa9179f35fe6dd3d8aac12ea64d1afb6df |