Falcon instrumentation for OpenTelemetry
Project description
This library builds on the OpenTelemetry WSGI middleware to track web requests in Falcon applications.
Installation
pip install opentelemetry-instrumentation-falcon
Configuration
Exclude lists
To exclude certain URLs from being tracked, set the environment variable OTEL_PYTHON_FALCON_EXCLUDED_URLS (or OTEL_PYTHON_EXCLUDED_URLS as fallback) with comma delimited regexes representing which URLs to exclude.
For example,
export OTEL_PYTHON_FALCON_EXCLUDED_URLS="client/.*/info,healthcheck"
will exclude requests such as https://site/client/123/info and https://site/xyz/healthcheck.
Request attributes
To extract certain attributes from Falcon’s request object and use them as span attributes, set the environment variable OTEL_PYTHON_FALCON_TRACED_REQUEST_ATTRS to a comma delimited list of request attribute names.
For example,
export OTEL_PYTHON_FALCON_TRACED_REQUEST_ATTRS='query_string,uri_template'
will extract path_info and content_type attributes from every traced request and add them as span attritbues.
Falcon Request object reference: https://falcon.readthedocs.io/en/stable/api/request_and_response.html#id1
Request/Response hooks
The instrumentation supports specifying request and response hooks. These are functions that get called back by the instrumentation right after a Span is created for a request and right before the span is finished while processing a response. The hooks can be configured as follows:
def request_hook(span, req): pass def response_hook(span, req, resp): pass FalconInstrumentation().instrument(request_hook=request_hook, response_hook=response_hook)
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
Hashes for opentelemetry-instrumentation-falcon-0.29b0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cf00f0c36ba0a1995f4f9f68948431b778eeb19d6973bc6bb5eed31b015a6e7 |
|
MD5 | 5c51aa8f4401f23190c1060b8b615960 |
|
BLAKE2b-256 | 408dd34bf6e8b476bbbf50d786765e743d0ccb3ff1c0dcbd6ddeeff1caa92663 |
Hashes for opentelemetry_instrumentation_falcon-0.29b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32216934ed1239a6e0e3d8f23b01cd5a109391a44684abde1d1aa0afaf90e9a5 |
|
MD5 | a937c275971479f5a92c807f2b84e6a3 |
|
BLAKE2b-256 | 2ef9d34daa7335a9cce10e01499af8e72278157b8cff6451fb74313d2140aa5e |