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.42b0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85bfb3f50f4f3bcc308e7f9d0c2bb72339c13633d22b21366919adc827655e75 |
|
MD5 | 32cdccd11d2f1d4f85e67c1b1b583b77 |
|
BLAKE2b-256 | 18b65085aa0fcdfd02fcd06a13a09d182ed5f3c0ab759b7670c0909265cbbae1 |
Hashes for opentelemetry_instrumentation_falcon-0.42b0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 499cb53a8e9f9e662bb37b6cb94339c51d9252207e1e18dd3fdc2cc77a8d837f |
|
MD5 | fef71d7d912df0ec74a6af85d22d790f |
|
BLAKE2b-256 | 4bb19cade5cd2a40518fd49a9a691991a81b952afa690c710fdc4d4909775373 |