diff --git a/docker-compose.yml b/docker-compose.yml index 4c0454f05..4f15f180f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -157,21 +157,19 @@ services: placement: constraints: - node.hostname==postgres - datadog-agent: - image: datadog/agent - restart: always - networks: - user-net: + otel-collector: + image: otel/opentelemetry-collector-contrib:0.72.0 + command: [--config=/etc/otel-collector-config.yaml] volumes: + - ./extras/otel/otel-collector-config.yaml:/etc/otel-collector-config.yaml # Pull docker stats - /var/run/docker.sock:/var/run/docker.sock:ro + restart: always + networks: + user-net: environment: - - DD_APM_ENABLED=true - - DD_APM_NON_LOCAL_TRAFFIC=true - - DD_SITE=datadoghq.eu - DD_API_KEY=${DD_API_KEY} - DD_ENV=${DD_ENV} - - DD_CONTAINER_LABELS_AS_TAGS={"project.name":"project_name"} deploy: placement: constraints: diff --git a/extras/otel/otel-collector-config.yaml b/extras/otel/otel-collector-config.yaml new file mode 100644 index 000000000..0b1526a8d --- /dev/null +++ b/extras/otel/otel-collector-config.yaml @@ -0,0 +1,63 @@ +receivers: + otlp: + protocols: + grpc: + # The hostmetrics receiver is required to get correct infrastructure metrics in Datadog. + hostmetrics: + collection_interval: 10s + scrapers: + paging: + metrics: + system.paging.utilization: + enabled: true + cpu: + metrics: + system.cpu.utilization: + enabled: true + disk: + filesystem: + metrics: + system.filesystem.utilization: + enabled: true + load: + memory: + network: + processes: + # The prometheus receiver scrapes metrics needed for the OpenTelemetry Collector Dashboard. + prometheus/otel: + config: + scrape_configs: + - job_name: 'otelcol' + scrape_interval: 10s + static_configs: + - targets: ['0.0.0.0:8888'] + docker_stats: + endpoint: unix:///var/run/docker.sock + +processors: + batch: + attributes: + actions: + - key: env + value: $(env:DD_ENV) + action: insert + +exporters: + datadog: + api: + site: datadoghq.eu + key: ${env:DD_API_KEY} +service: + pipelines: + traces: + receivers: [otlp] + processors: [attributes, batch] + exporters: [datadog] + logs: + receivers: [otlp] + processors: [attributes, batch] + exporters: [datadog] + metrics: + receivers: [hostmetrics, prometheus/otel, docker_stats, otlp] + processors: [batch] + exporters: [datadog]