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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49155eb91c8582912ea1efd08bf9dea90baa4b29401fb8f17674dbc7aa40cd08 |
|
MD5 | 5bb01b6652f3b3e6147cfd5f53422f07 |
|
BLAKE2b-256 | 0f4fb3a55685e951d853b5a43c4411af08b29507a4d6b856e064318f285aa73c |
Close
Hashes for opencensus_ext_flask-0.8.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f50517d57ad9d004b32c1f308e249c895e222a124e8ded00e580e5030a97372d |
|
MD5 | 4ec9ee0413a05fb43373930069daf17e |
|
BLAKE2b-256 | f3d6ee462d10167a7596a1cb69b7975cd9ff0516c28b39b7e343429a3618267b |