Flask Instrumentation

AppSignal for PythonThis feature requires version 0.1.2 or higher.
FlaskThis feature requires version 2.3.3 or lower.

Flask is a lightweight web framework for Python that enables the development of web applications with simplicity and flexibility.

Install the Instrumentation

Don't forget to install the AppSignal for Python package in your application first.

First, install the opentelemetry-instrumentation-flask package. To add it to your project, add the following line to your requirements.txt file:

shell
# requirements.txt opentelemetry-instrumentation-flask

The AppSignal for Python integration will automatically use this instrumentation when the corresponding package is installed. To disable this instrumentation without uninstalling the package, use the disable_default_instrumentations configuration option.

Setup

It's necessary to import and start the AppSignal client before the Flask library is imported. This ensures that the application instance is created with the automatic instrumentation applied.

python
# app.py import appsignal appsignal.start() from flask import Flask # noqa: E402 app = Flask(__name__) # your app code