Flask library instrumentor
Like the Requests library, the Flask instrumentation library contains an implementation of the BaseInstrumentor
interface. The code is available in the OpenTelemetry Python contrib
repository at https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py. The implementation leverages a few different aspects of the Flask library to achieve instrumentation. It wraps the original Flask app and registers a callback via the before_request
method. It then provides a middleware to execute instrumentation code at response time. This allows the instrumentation to capture the beginning and the end of requests through the library.
Additional configuration options
The following options are available to configure FlaskInstrumentor
further:
excluded_urls
: Supports a comma-separated list of regular expressions for excluding specific URLs from...