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’srequirements.txt:
Configure OpenTelemetry in your application
Add thisappsignal.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.
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 thesettings.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 thetasks.py file of your Celery application, add a connection callback for worker processes and import the appsignal.py module within it.