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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab6c8bcda0f5344a723cea7a4cabd8c201e6d9042b583b6170c83879e63f5f00 |
|
MD5 | e459deaf23c1157c22c6e9f6a6bdf507 |
|
BLAKE2b-256 | e51d09c4c0cb4c94470c8cedd967b4ccba0c1dbd518f544f1f92c439c4c00da1 |
Close
Hashes for opencensus_ext_flask-0.7.6-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a662ea8f1425950b7d89dd6f18e672bd2e9efd1f795433dde1901ef465be6fdc |
|
MD5 | f698a2f2233db58bfb2117875090310d |
|
BLAKE2b-256 | 4e97208c93c9fc4e11c20904ab59332a0e52a813877e69f8e036c7a8a46c2475 |