Skip to main content

OpenCensus Flask Integration

Project description

pypi

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, blacklist_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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

opencensus_ext_flask-0.7.2-py2.py3-none-any.whl (5.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file opencensus_ext_flask-0.7.2-py2.py3-none-any.whl.

File metadata

  • Download URL: opencensus_ext_flask-0.7.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.0

File hashes

Hashes for opencensus_ext_flask-0.7.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4fe272c403793d80974d2ab0f5a116b9f79449f76d8f5afdb8fbfe112f757b1e
MD5 dbaea0ec5d67605f8bfb03dd6a0c245a
BLAKE2b-256 8162de1a721143df4103f6f000d7108f49b08a1dc9a541315af96ed2dca9e778

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page