Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

OpenCensus Flask Integration

Project description



pip install opencensus-ext-flask


from flask import Flask
from opencensus.ext.flask.flask_middleware import FlaskMiddleware

app = Flask(__name__)
middleware = FlaskMiddleware(app, blacklist_paths=['_ah/health'])

def hello():
    return 'Hello World!'

if __name__ == '__main__':
    import logging
    logger = logging.getLogger('werkzeug')
    logger.setLevel(logging.ERROR)'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(


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for opencensus-ext-flask, version 0.7.3
Filename, size File type Python version Upload date Hashes
Filename, size opencensus_ext_flask-0.7.3-py2.py3-none-any.whl (5.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page