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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11d1860e5f38b0361b8e8d9deaec8cba7f885d5ed868bbc9f36ec8d1b8197265 |
|
MD5 | d538568d2237c78afd2d1ff5c38245e5 |
|
BLAKE2b-256 | da5d7ccbf2ce67c7e624a1596e4e0ad51e44e29dddbd88141f7bf4693b9dd7e0 |
Close
Hashes for opencensus_ext_flask-0.8.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a81ea8a26a19b9b62baccbf5d35b3eb7654f6e268b127dcb8a5c120f4d114d15 |
|
MD5 | d6674843dc8175a698860d81f812ff16 |
|
BLAKE2b-256 | 7a596542f3680603a77764aa5d5d4b255be92d28f30385708e4c60522a73fc41 |