Migrate to EDOT Python from the Elastic APM Python agent
Elastic Stack Serverless Observability
Learn the differences between the Elastic APM Python agent and the Elastic Distribution of OpenTelemetry Python (EDOT Python).
Follow the steps to migrate your instrumentation and settings. For step-by-step instructions on setting up EDOT Python refer to Setup.
Follow these steps to migrate:
- Remove any configuration and setup code needed by Elastic APM Python Agent from your application source code.
- Migrate any usage of Elastic APM Python Agent API to manual instrumentation with OpenTelemetry API in the application source code.
- Follow the setup documentation on to install and configure EDOT Python.
The following are Elastic APM Python agent settings that you can migrate to EDOT Python.
The Elastic api_key
option corresponds to the OpenTelemetry OTEL_EXPORTER_OTLP_HEADERS option.
For example: OTEL_EXPORTER_OTLP_HEADERS="Authorization=ApiKey an_api_key"
.
The Elastic enabled
option corresponds to the OpenTelemetry OTEL_SDK_DISABLED option.
The Elastic environment
option corresponds to setting the deployment.environment.name
key in OTEL_RESOURCE_ATTRIBUTES.
For example: OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=testing
.
The Elastic global_labels
option corresponds to adding key=value
comma separated pairs in OTEL_RESOURCE_ATTRIBUTES.
For example: OTEL_RESOURCE_ATTRIBUTES=alice=first,bob=second
. Such labels will result in labels.key=value attributes on the server, e.g. labels.alice=first
The Elastic metrics_interval
corresponds to the OpenTelemetry OTEL_METRIC_EXPORT_INTERVAL option.
For example: OTEL_METRIC_EXPORT_INTERVAL=30000
.
The Elastic secret_token
option corresponds to the OpenTelemetry OTEL_EXPORTER_OTLP_HEADERS option.
For example: OTEL_EXPORTER_OTLP_HEADERS="Authorization=ApiKey an_apm_secret_token"
.
The Elastic server_url
option corresponds to the OpenTelemetry OTEL_EXPORTER_OTLP_ENDPOINT
option.
The Elastic service_name
option corresponds to the OpenTelemetry OTEL_SERVICE_NAME option.
You can also set the service name using OTEL_RESOURCE_ATTRIBUTES.
For example: OTEL_RESOURCE_ATTRIBUTES=service.name=myservice
. If OTEL_SERVICE_NAME
is set, it takes precedence over the resource attribute.
The Elastic service_version
option corresponds to setting the service.version
key in OTEL_RESOURCE_ATTRIBUTES.
For example: OTEL_RESOURCE_ATTRIBUTES=service.version=1.2.3
.
Evaluate the differences in performance overhead between EDOT Python and Elastic APM Python agent.
The following limitations apply when migrating to EDOT Python.
EDOT Python lacks an equivalent to the central configuration feature that the Elastic APM Python agent supports. When using EDOT Python, all of the configurations are static and you should provide them to the application through other means, such as environment variables.
A custom lambda layer for the Elastic Distribution of OpenTelemetry Python is not currently available. Refer to the upstream Lambda Auto-Instrumentation.
The following libraries are currently missing an OpenTelemetry equivalent:
- Azure storage and Azure queue
aiobotocore
aiomysql
aiopg
aioredis
Graphene
httplib2
pylibmc
pyodbc
Sanic
zlib
EDOT Python lacks a structlog integration at the moment.
EDOT Python does not implement span compression.
EDOT Python is not sending metrics that power the Breakdown metrics.