Dapr integrates with the Dynatrace Collector using the OpenTelemetry protocol (OTLP). This guide walks through an example using Dapr to push traces to Dynatrace, using the Dynatrace version of the OpenTelemetry Collector.
openTelemetryTrace.ingest
, metrics.ingest
, and logs.ingest
scopesTo push traces to your Dynatrace instance, install the Dynatrace OpenTelemetry Collector on your Kubernetes cluster.
Create a Kubernetes secret with your Dynatrace credentials:
kubectl create secret generic dynatrace-otelcol-dt-api-credentials \
--from-literal=DT_ENDPOINT=https://YOUR_TENANT.live.dynatrace.com/api/v2/otlp \
--from-literal=DT_API_TOKEN=dt0s01.YOUR_TOKEN_HERE
Replace YOUR_TENANT
with your Dynatrace tenant ID and YOUR_TOKEN_HERE
with your Dynatrace API token.
Use the Dynatrace OpenTelemetry Collector distribution for better defaults and support than the open source version. Download and inspect the collector-helm-values.yaml
file. This is based on the k8s enrichment demo and includes Kubernetes metadata enrichment for proper pod/namespace/cluster context.
Deploy the Dynatrace Collector with Helm.
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo update
helm upgrade -i dynatrace-collector open-telemetry/opentelemetry-collector -f collector-helm-values.yaml
Create a Dapr configuration file to enable tracing and send traces to the OpenTelemetry Collector via OTLP.
Update the following file to ensure the endpointAddress
points to your Dynatrace OpenTelemetry Collector service in your Kubernetes cluster. If deployed in the default
namespace, it’s typically dynatrace-collector.default.svc.cluster.local
.
Important: Ensure the endpointAddress
does NOT include the http://
prefix to avoid URL encoding issues:
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: tracing
spec:
tracing:
samplingRate: "1"
otel:
endpointAddress: "dynatrace-collector.default.svc.cluster.local:4318" # Update with your collector's service address
Apply the configuration with:
kubectl apply -f collector-config-otel.yaml
Apply the tracing
configuration by adding a dapr.io/config
annotation to the Dapr applications that you want to include in distributed tracing, as shown in the following example:
apiVersion: apps/v1
kind: Deployment
metadata:
...
spec:
...
template:
metadata:
...
annotations:
dapr.io/enabled: "true"
dapr.io/app-id: "MyApp"
dapr.io/app-port: "8080"
dapr.io/config: "tracing"
appconfig
configuration to tracing
.You can register multiple tracing exporters at the same time, and the tracing logs are forwarded to all registered exporters.
That’s it! There’s no need to include any SDKs or instrument your application code. Dapr automatically handles the distributed tracing for you.
Deploy and run some applications. After a few minutes, you should see traces appearing in your Dynatrace tenant:
If you are running Dynatrace OneAgent in your cluster, you should exclude the daprd
sidecar container from OneAgent monitoring to prevent interferences in this configuration. Excluding it prevents any automatic injection attempts that could break functionality or result in confusing traces.
Add this annotation to your application deployments or globally in your dynakube configuration file:
metadata:
annotations:
dapr.io/enabled: "true"
dapr.io/app-id: "MyApp"
dapr.io/app-port: "8080"
dapr.io/config: "tracing"
container.inject.dynatrace.com/daprd: "false" # Exclude dapr sidecar from being auto-monitored by OneAgent