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
File details
Details for the file opencensus-ext-flask-0.8.2.tar.gz
.
File metadata
- Download URL: opencensus-ext-flask-0.8.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49155eb91c8582912ea1efd08bf9dea90baa4b29401fb8f17674dbc7aa40cd08 |
|
MD5 | 5bb01b6652f3b3e6147cfd5f53422f07 |
|
BLAKE2b-256 | 0f4fb3a55685e951d853b5a43c4411af08b29507a4d6b856e064318f285aa73c |
File details
Details for the file opencensus_ext_flask-0.8.2-py2.py3-none-any.whl
.
File metadata
- Download URL: opencensus_ext_flask-0.8.2-py2.py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f50517d57ad9d004b32c1f308e249c895e222a124e8ded00e580e5030a97372d |
|
MD5 | 4ec9ee0413a05fb43373930069daf17e |
|
BLAKE2b-256 | f3d6ee462d10167a7596a1cb69b7975cd9ff0516c28b39b7e343429a3618267b |