-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
83 lines (82 loc) · 3.14 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
version: '3.6'
services:
py-http-otel: # flask http server instrumented with OpenTelemetry
build: ./http-otel/
image: ${REPO:-duxing/otel-datadog-apm-py/http-otel}:${TAG:-latest}
# to auto-instrument: prepent command with "opentelemetry-instrument"
# manual instrumentation is setup in code.
command: ["flask", "run", "-h", "0.0.0.0", "-p", "8080"]
environment:
ENV: ${ENV}
SERVICE: ${SERVICE}-otel
VERSION: ${VERSION:-latest}
# created in code: need multiple resources.
# OTEL_SERVICE_NAME: ${SERVICE}-http-otel
# OTEL_RESOURCE_ATTRIBUTES: "service.name=${SERVICE}-otel-api,deployment.environment=${ENV},service.version=${VERSION:-latest}"
# datadog:4317 (DataDog OTEL ingestion is not stable yet)
OTEL_EXPORTER_OTLP_ENDPOINT: otel-collector:4317 # trace over grpc
REDIS0_HOST: redis0
REDIS0_PORT: 6379
REDIS1_HOST: redis1
REDIS1_PORT: 6379
SHARED_REDIS_SERVICE_NAME: another-service-redis
ports:
- 8080
py-http-dd: # flask http server instrumented with ddtrace
build: ./http-dd/
image: ${REPO:-duxing/otel-datadog-apm-py/http-dd}:${TAG:-latest}
# prepent command with "ddtrace" to auto-instrument
command: ["flask", "run", "-h", "0.0.0.0", "-p", "8080"]
environment:
SERVICE: ${SERVICE}-dd
DD_SERVICE: ${SERVICE}-dd-api
DD_ENV: ${ENV}
DD_VERSION: ${VERSION:-latest}
DD_TAGS: "lang:py,impl:ddtrace"
DD_TRACE_AGENT_URL: http://datadog:8126 # trace over http
# use DD_SERVICE_MAPPING: turn on if necessary
DD_TRACE_SAMPLE_RATE: 1.0
DD_TRACE_ENABLED: "True"
DD_PATCH_MODULES: "flask:true,redis:false"
REDIS0_HOST: redis0
REDIS0_PORT: 6379
REDIS1_HOST: redis1
REDIS1_PORT: 6379
SHARED_REDIS_SERVICE_NAME: another-service-redis
ports:
- 8080
redis0:
image: redis:6-alpine
ports:
- 6379
redis1:
image: redis:6-alpine
ports:
- 6379
datadog:
image: datadog/agent:7.35.0
environment:
DD_LOG_LEVEL: "OFF"
DD_API_KEY: ${DD_API_KEY}
DD_APM_ENABLED: "true"
DD_APM_NON_LOCAL_TRAFFIC: "true"
DD_DOGSTATSD_NON_LOCAL_TRAFFIC: "true"
# OTEL ingestion related configurations:
# DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GRPC_ENDPOINT: 0.0.0.0:4317
# DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GRPC_TRANSPORT: tcp
# DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT: 0.0.0.0:4318
# DD_OTLP_CONFIG_METRICS_ENABLED: "true"
# DD_OTLP_CONFIG_TRACES_ENABLED: "true"
otel-collector:
image: otel/opentelemetry-collector-contrib-dev:latest
command: ["--config=/etc/otel-collector-config.yaml", "--config=env:COLLECTOR_EXTRA_CONFIG", "${OTELCOL_ARGS:-}"]
environment:
DD_API_KEY: ${DD_API_KEY}
# see: https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/8396
COLLECTOR_EXTRA_CONFIG: "exporters::datadog::tags: [\"lang:py\", \"impl:opentelemetry\"]"
volumes:
- ./config/otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- 13133 # health_check extension
- 4317 # OTLP gRPC receiver
- 55679 # zpages extension