Skip to main content
To send OpenTelemetry data from your Python application to AppSignal, you can either use the AppSignal for Python package or install and configure OpenTelemetry manually.

Using the AppSignal for Python package

The AppSignal for Python package can automatically configure OpenTelemetry to send data to the AppSignal collector. It can also automatically enable OpenTelemetry instrumentations for popular libraries and frameworks. Follow the instructions in the AppSignal for Python installation documentation to install the package and set up the configuration file, then follow the instructions in the AppSignal for Python collector configuration page to use it with the AppSignal Collector.

Installing OpenTelemetry manually

Make sure to install the AppSignal collector before proceeding with these instructions.

Install the OpenTelemetry packages

Add the OpenTelemetry SDK, OTLP exporter and instrumentation packages to your application’s requirements.txt:
Also add the OpenTelemetry instrumentation packages for the libraries and frameworks that your application uses. For example, if you’re using Django and Celery:
Check out the OpenTelemetry registry for instrumentation packages for most libraries and frameworks.

Configure OpenTelemetry in your application

Add this appsignal.py file to your application with the OpenTelemetry exporter and AppSignal configuration. Then, import that file before your application starts. Make sure to update the values below with your AppSignal application name, environment and push API key, and to replace the exporter endpoint with the address of your AppSignal collector if needed.
Then, in the same file, after the OpenTelemetry setup, initialize the OpenTelemetry instrumentations for the libraries and frameworks that your application uses. For example, if you’re using the Django and Celery instrumentations:
Finally, call the initialize_opentelemetry function with the name of the service that is being monitored, as early as possible in your application’s entry point. A common choice for the service name is the name of the framework used.

Usage with Django

In the settings.py file of your Django application, import the appsignal.py module at the beginning of the file and call the initialize_opentelemetry function:

Usage with Celery

In the tasks.py file of your Celery application, add a connection callback for worker processes and import the appsignal.py module within it.

Test the app!

Now that all the components are connected, start your app and test if you see data arrive in AppSignal. Check the “Errors > Issue list” and “Performance > Traces” page specifically. If after following our installation instructions you still don’t see data in AppSignal, let us know and we’ll help you finalize your OpenTelemetry installation!