Skip to content

Commit 23cbc0f

Browse files
authored
Add example how to export OpenTelemetry data to Dynatrace (#7)
1 parent e860dfd commit 23cbc0f

5 files changed

Lines changed: 63 additions & 9 deletions

File tree

.env

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ PROMETHEUS_ADDR=${PROMETHEUS_SERVICE_HOST}:${PROMETHEUS_SERVICE_PORT}
3838

3939
# NewRelic
4040
NEW_RELIC_OTLP_ENDPOINT=https://otlp.eu01.nr-data.net:4317
41-
NEW_RELIC_LICENSE_KEY=
41+
NEW_RELIC_LICENSE_KEY=
42+
43+
# Dynatrace
44+
DYNATRACE_OTLP_ENDPOINT=https://your-endpoint.live.dynatrace.com/api/v2/otlp
45+
DYNATRACE_API_TOKEN="Api-Token dt0c01.your.key"

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ To start it use the following command:
1010
docker-compose --env-file .env up --no-build
1111
```
1212

13+
## NewRelic
1314
The collector is preconfigured to export metric, traces and log entries to NewRelic.
14-
In order to activate it add your NewRelic api key to the `.env` file and restart the
15-
containers.
15+
In order to activate it add your NewRelic api key to the `.env` file. Make sure OpenTelemetry Collector service
16+
in [docker-compose.yml](./docker-compose.yaml) has the NewRelic command uncommented.
17+
Restart the containers.
18+
19+
## Dynatrace
20+
The collector is preconfigured to export metric, traces and log entries to Dynatrace.
21+
In order to activate it add your Dynatrace OTLP endpoint and Dynatrace API key to the `.env` file.
22+
Make sure OpenTelemetry Collector service
23+
in [docker-compose.yml](./docker-compose.yaml) has the Dynatrace command uncommented.
24+
Restart the containers.
1625

1726
## Jaeger UI
1827

@@ -24,4 +33,4 @@ http://localhost:3000
2433

2534
## Prometheus
2635

27-
http://localhost:9090
36+
http://localhost:9090

docker-compose.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ networks:
99
default:
1010
name: opentelemetry-demo
1111
driver: bridge
12-
12+
1313
services:
1414
# ********************
1515
# Telemetry Components
@@ -62,11 +62,15 @@ services:
6262
limits:
6363
memory: 125M
6464
restart: unless-stopped
65-
command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-observability.yml", "--config=/etc/otelcol-config-extras.yml" ]
65+
# New Relic
66+
command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-observability.yml", "--config=/etc/otelcol-config-newrelic.yml" ]
67+
# Dynatrace
68+
# command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-observability.yml", "--config=/etc/otelcol-config-dynatrace.yml" ]
6669
volumes:
6770
- ./src/otelcollector/otelcol-config.yml:/etc/otelcol-config.yml
6871
- ./src/otelcollector/otelcol-observability.yml:/etc/otelcol-observability.yml
69-
- ./src/otelcollector/otelcol-config-extras.yml:/etc/otelcol-config-extras.yml
72+
- ./src/otelcollector/otelcol-config-newrelic.yml:/etc/otelcol-config-newrelic.yml
73+
- ./src/otelcollector/otelcol-config-dynatrace.yml:/etc/otelcol-config-dynatrace.yml
7074
ports:
7175
- "4317:4317" # OTLP over gRPC receiver
7276
- "4318:4318" # OTLP over HTTP receiver
@@ -78,6 +82,8 @@ services:
7882
environment:
7983
- NEW_RELIC_OTLP_ENDPOINT=${NEW_RELIC_OTLP_ENDPOINT}
8084
- NEW_RELIC_LICENSE_KEY=${NEW_RELIC_LICENSE_KEY}
85+
- DYNATRACE_OTLP_ENDPOINT=${DYNATRACE_OTLP_ENDPOINT}
86+
- DYNATRACE_API_TOKEN=${DYNATRACE_API_TOKEN}
8187

8288
# Prometheus
8389
prometheus:
@@ -100,4 +106,4 @@ services:
100106
memory: 300M
101107
ports:
102108
- "${PROMETHEUS_SERVICE_PORT}:${PROMETHEUS_SERVICE_PORT}"
103-
logging: *logging
109+
logging: *logging
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
exporters:
2+
otlphttp/dynatrace:
3+
endpoint: ${DYNATRACE_OTLP_ENDPOINT}
4+
headers:
5+
Authorization: ${DYNATRACE_API_TOKEN}
6+
7+
processors:
8+
cumulativetodelta:
9+
filter:
10+
metrics:
11+
exclude:
12+
match_type: strict
13+
metric_names:
14+
- queueSize
15+
- duration
16+
- http.server.duration
17+
- http.client.duration
18+
- process.runtime.jvm.system.cpu.load_1m
19+
- process.runtime.jvm.gc.duration
20+
- jvm.gc.pause
21+
- spring.security.filterchains
22+
- spring.security.http.secured.requests
23+
- spring.security.authorizations
24+
- http.server.requests
25+
26+
27+
service:
28+
pipelines:
29+
traces:
30+
exporters: [otlp, logging, spanmetrics, otlphttp/dynatrace]
31+
metrics:
32+
processors: [filter, cumulativetodelta, transform, batch]
33+
exporters: [prometheus, logging, otlphttp/dynatrace]
34+
logs:
35+
exporters: [logging, otlphttp/dynatrace]

src/otelcollector/otelcol-config-extras.yml renamed to src/otelcollector/otelcol-config-newrelic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ service:
1616
metrics:
1717
exporters: [prometheus, logging, otlp/2]
1818
logs:
19-
exporters: [logging, otlp/2]
19+
exporters: [logging, otlp/2]

0 commit comments

Comments
 (0)