Python
Instrument your app using the opentelemetry-instrumentation
package and export traces to Aspecto's opentelemetry collector.
Install Opentelemetry Instrumentation Packages
To create automatic traces from packages you use in your application (flask, requests, etc), you need to additionally install a relevant instrumentation package. For example, if you use flask
in your application, you need to install the package opentelemetry-instrumentation-flask
.
To print recommended instrumentation packages based on your active site-packages directory, run:
To install these packages, run:
You can also directly install a specific instrumentation package. A list of community instrumentation packages can be found in the opentelemetry-python-contrib repo here
Running Your App with Auto Instrumentation
You need to setup the following environment variables to export the traces to Aspecto:
OTEL_SERVICE_NAME
- set to the name of the serviceOTEL_EXPORTER_OTLP_HEADERS
- set toAuthorization=${YOUR_ASPECTO_TOKEN}
. You can get your token here.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- set tohttps://otelcol.aspecto.io:4317
Then, run your app with the opentelemetry-instrument
command:
Last updated