Skip to content

Commit e1c652e

Browse files
committed
Add Dynatrace OpenTelemetry Collector integration guide
- Comprehensive setup instructions for Dynatrace OTEL Collector - Dapr tracing configuration with proper endpoint setup - OneAgent exclusion guidance to prevent sidecar conflicts - Troubleshooting section with common issues and solutions - Links to sample implementations and resources Fixes #3887 Signed-off-by: MyMirelHub <[email protected]>
1 parent 7bc2f2c commit e1c652e

File tree

2 files changed

+131
-0
lines changed

2 files changed

+131
-0
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
type: docs
3+
title: "Using Dynatrace OpenTelemetry Collector to collect traces to send to Dynatrace"
4+
linkTitle: "Using the Dynatrace OpenTelemetry Collector"
5+
weight: 1000
6+
description: "How to push trace events to Dynatrace, using the Dynatrace OpenTelemetry Collector."
7+
---
8+
9+
Dapr integrates with the [Dynatrace Collector](https://docs.dynatrace.com/docs/ingest-from/opentelemetry/collector) using the OpenTelemetry protocol (OTLP). This guide walks through an example using Dapr to push traces to Dynatrace, using the Dynatrace OpenTelemetry Collector.
10+
11+
12+
## Prerequisites
13+
14+
- [Install Dapr on Kubernetes]({{< ref kubernetes >}})
15+
- Access to a Dynatrace tenant and an API token with `openTelemetryTrace.ingest`, `metrics.ingest`, and `logs.ingest` scopes
16+
17+
## Set up Dynatrace OpenTelemetry Collector to push to your Dynatrace instance
18+
19+
1. Create a Kubernetes secret with your Dynatrace credentials:
20+
21+
```sh
22+
kubectl create secret generic dynatrace-otelcol-dt-api-credentials \
23+
--from-literal=DT_ENDPOINT=https://YOUR_TENANT.live.dynatrace.com/api/v2/otlp \
24+
--from-literal=DT_API_TOKEN=dt0s01.YOUR_TOKEN_HERE
25+
```
26+
27+
Replace `YOUR_TENANT` with your Dynatrace tenant ID and `YOUR_TOKEN_HERE` with your Dynatrace API token.
28+
29+
1. Use the Dynatrace OpenTelemetry Collector distribution for better defaults and support. Download and inspect the [`collector-helm-values.yaml`](https://github.com/Dynatrace/dynatrace-otel-collector/blob/main/config_examples/collector-helm-values.yaml) file. This is based on the [k8s enrichment demo](https://docs.dynatrace.com/docs/ingest-from/opentelemetry/collector/use-cases/kubernetes/k8s-enrich#demo-configuration) and includes Kubernetes metadata enrichment for proper pod/namespace/cluster context.
30+
31+
32+
1. Deploy the Dynatrace Collector
33+
34+
```sh
35+
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
36+
helm repo update
37+
helm upgrade -i dynatrace-collector open-telemetry/opentelemetry-collector -f collector-helm-values.yaml
38+
```
39+
40+
## Set up Dapr to send traces to the Dynatrace Collector
41+
42+
43+
1. Create a Dapr configuration file to enable tracing and send traces to the Dynatrace OpenTelemetry Collector. Ensure the `endpointAddress` points to your Dynatrace OpenTelemetry Collector service in the cluster. If deployed in the `default` namespace, it's typically `dynatrace-collector.default.svc.cluster.local`.
44+
45+
**Important:** Ensure the `endpointAddress` does NOT include the `http://` prefix to avoid URL encoding issues:
46+
47+
```yaml
48+
apiVersion: dapr.io/v1alpha1
49+
kind: Configuration
50+
metadata:
51+
name: tracing
52+
spec:
53+
tracing:
54+
samplingRate: "1"
55+
otel:
56+
endpointAddress: "dynatrace-collector.default.svc.cluster.local:4318" # Update with your collector's service address
57+
```
58+
59+
1. Apply the configuration with:
60+
61+
```sh
62+
kubectl apply -f collector-config-otel.yaml
63+
```
64+
65+
## Deploy your app with tracing
66+
67+
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:
68+
69+
```yaml
70+
apiVersion: apps/v1
71+
kind: Deployment
72+
metadata:
73+
...
74+
spec:
75+
...
76+
template:
77+
metadata:
78+
...
79+
annotations:
80+
dapr.io/enabled: "true"
81+
dapr.io/app-id: "MyApp"
82+
dapr.io/app-port: "8080"
83+
dapr.io/config: "tracing"
84+
```
85+
86+
{{% alert title="Note" color="primary" %}}
87+
If you are using one of the Dapr tutorials, such as [distributed calculator](https://github.com/dapr/quickstarts/tree/master/tutorials/distributed-calculator), you will need to update the `appconfig` configuration to `tracing`.
88+
{{% /alert %}}
89+
90+
You can register multiple tracing exporters at the same time, and the tracing logs are forwarded to all registered exporters.
91+
92+
That's it! There's no need to include any SDKs or instrument your application code. Dapr automatically handles the distributed tracing for you.
93+
94+
## View traces
95+
96+
Deploy and run some applications. After a few minutes, you should see tracing logs appearing in your Dynatrace tenant:
97+
98+
1. Navigate to **Search > Distributed tracinng** in your Dynatrace UI.
99+
2. Filter by service names to see your Dapr applications
100+
101+
<img src="/images/open-telemetry-collector-dynatrace-traces.png" width=1200 alt="Dynatrace showing tracing data.">
102+
103+
{{% alert title="Note" color="primary" %}}
104+
Only operations going through Dapr API exposed by Dapr sidecar (for example, service invocation or event publishing) are displayed in Dynatrace distributed traces.
105+
{{% /alert %}}
106+
107+
108+
{{% alert title="Disable OneAgent daprd monitoring" color="warning" %}}
109+
If you are running Dynatrace OneAgent in your cluster, you should exclude the `daprd` container from OneAgent monitoring to prevent interferences in this configuration, excluding them prevents any injection attempts that could break functionality.
110+
111+
112+
Add this annotation to your application deployments or globally in your dynakube configuration file:
113+
114+
```yaml
115+
metadata:
116+
annotations:
117+
dapr.io/enabled: "true"
118+
dapr.io/app-id: "MyApp"
119+
dapr.io/app-port: "8080"
120+
dapr.io/config: "tracing"
121+
container.inject.dynatrace.com/daprd: "false"
122+
123+
```
124+
{{% /alert %}}
125+
126+
## Related links
127+
- Try out the [observability quickstart](https://github.com/dapr/quickstarts/tree/master/tutorials/observability/README.md)
128+
- Learn how to set [tracing configuration options]({{< ref "configuration-overview.md#tracing" >}})
129+
- [Dynatrace OpenTelemetry documentation](https://docs.dynatrace.com/docs/ingest-from/opentelemetry)
130+
- Enrich traces with Kubernetes metadata [Enrich from Kubernetes
131+
](https://docs.dynatrace.com/docs/ingest-from/opentelemetry/collector/use-cases/kubernetes/k8s-enrich)
109 KB
Loading

0 commit comments

Comments
 (0)