title | layout | nav_order | parent |
---|---|---|---|
Migration |
default |
6 |
EDOT Java |
This documentation describes how to update applications that are currently using the Elastic APM Java agent to use the Elastic Distribution of OpenTelemetry Java (EDOT Java).
Allows to capture, send, transform and store data in an OpenTelemetry native way. This includes for example the ability to use all features of the OpenTelemetry SDK for manual tracing, data following semantic conventions or ability to use intermediate collectors and processors.
OpenTelemetry Java Instrumentation provides a broad coverage of libraries and frameworks.
EDOT Java is a fully compatible drop-in replacement for the upstream OpenTelemetry Java Agent. Hence, there's no vendor lock-in through proprietary instrumentation or agent.
EDOT Java agent and OpenTelemetry Java instrumentation are only compatible with Java 8 and later.
Support for LDAP client instrumentation is not available in EDOT Java, yet.
Currently EDOT Java does not have an equivalent of the central configuration feature that the Elastic APM Java agent supports. When using EDOT Java, all the configurations are static and should be provided to the application with other configurations, e.g. environment variables.
EDOT Java does not implement span compression.
EDOT Java is not sending metrics that power the Breakdown metrics.
There is currently no EDOT Java equivalent for starting the agent with the remote attach capability. The -javaagent:
option is the preferred startup mechanism. There is a migration path for starting the agent with self attach, which is to use runtime attachment.
By default, micrometer instrumentation is disabled and won't capture metrics, enabling requires to set otel.instrumentation.micrometer.enabled=true
.
-
Review all pros/cons of this migration guide including the differences in performance overhead.
-
(Optional) Migrate manual instrumentation API: Usages of the Elastic APM Agent API require migration to OpenTelemetry API:
- for Annotation API see OpenTelemetry Annotations.
- for Transaction API see OpenTelemetry API.
{: .note} Migration of application code using these APIs and annotations is not strictly required when deploying the EDOT agent. If not migrated, the spans, transactions and metrics that were previously explicitly created with those custom API calls and annotations, will no longer be generated. The broader OpenTelemetry instrumentation coverage may replace the need for some or all of these custom code changes.
-
Replace configuration options using the Reference below, see Configuration for ways to provide those.
-
Replace Agent binary
- Remove the
-javaagent:
argument containing Elastic APM Java agent from the JVM arguments - Add
-javaagent:
argument to the JVM arguments to use EDOT Java and restart the application or follow Kubernetes instructions if applicable
- Remove the
This list contains APM Java agent configuration options that can be migrated to EDOT Java agent configuration because they have an equivalent in OpenTelemetry:
- server_url
- server_urls
- secret_token
- api_key
- service_name
- enabled
- service_version
- environment
- global_labels
- trace_methods
The Elastic server_url
option corresponds to the OpenTelemetry OTEL_EXPORTER_OTLP_ENDPOINT
option.
The Elastic server_urls
option has no equivalent OpenTelemetry option - you can only specify one endpoint.
Use OTEL_EXPORTER_OTLP_ENDPOINT instead.
The Elastic secret_token
option corresponds to the OpenTelemetry OTEL_EXPORTER_OTLP_HEADERS option.
For example: OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer an_apm_secret_token"
.
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 service_name
option corresponds to the OpenTelemetry OTEL_SERVICE_NAME option.
The service name value can also be set 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 enabled
option corresponds to the OpenTelemetry OTEL_JAVAAGENT_ENABLED option.
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
.
The Elastic environment
option corresponds to setting the deployment.environment
key in OTEL_RESOURCE_ATTRIBUTES.
For example: OTEL_RESOURCE_ATTRIBUTES=deployment.environment=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 [trace_methods
] option can be replaced by the OTEL_INSTRUMENTATION_METHODS_INCLUDE
OpenTelemetry option, however the syntax is different and the ability to use wildcards is more limited.