Skip to content

Migrate from AppDynamics to OpenTelemetry

We are deprecating AppDynamics in favor of OpenTelemetry and by the end of 2024 all applications must be migrated to OpenTelemetry for observability. This guide will help you migrate from AppDynamics to OpenTelemetry AutoInstrumentation.

Dockerfile

To migrate from AppDynamics to OpenTelemetry, you need to remove the AppDynamics agent from your Dockerfile and add the OpenTelemetry AutoInstrumentation agent.

Since we will be using the AutoInstrumentation feature of NAIS, you do not need to add any additional agents in your Dockerfile. The OpenTelemetry agent will be injected into your application automatically.

Here is an example removing the -appdynamics tag from the base image:

--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
-FROM ghcr.io/navikt/baseimages/temurin:21-appdynamics
+FROM ghcr.io/navikt/baseimages/temurin:21

AppDynamics specific enviorment variables should also be removed from the Dockerfile.

--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
-ENV APPDYNAMICS=/apikey/appdynamics/prod
-ENV APPD_ENABLED=true
-ENV APPD_NAME=my-application

nais.yaml

To enable OpenTelemetry AutoInstrumentation in your application, you need to add the following configuration to your nais.yaml file:

spec:
  observability:
    autoInstrumentation:
      enabled: true
      runtime: java

If you prefer using Elastic APM instead of Grafana you can set the destinations configuration:

spec:
  observability:
    autoInstrumentation:
      enabled: true
      runtime: java
      destinations:
        - id: elastic-apm

Info

If you have multiple virtual environments for your application you can set the deployment.environment.name resource attribute in your nais.yaml file to differentiate between them like so:

spec:
  env:
    - name: OTEL_RESOURCE_ATTRIBUTES
      value: deployment.environment.name=q1

You can now safly remove any references to AppDymamics in the .spec.env and .spec.vault sections of your nais.yaml file.

Resources