Configuring Datadog with OpenTelemetry
Evolve services export traces and metrics through OpenTelemetry (OTel) to an OTel Collector or directly to a backend. Datadog is OTel-compatible and works without changes to service code. This guide covers configuring the Collector exporter, environment variables, and Terraform secrets.
-
Configure the OTel Collector exporter
Add a Datadog exporter to your OpenTelemetry Collector configuration. The local development setup in
docker/otel-collector/otel-collector-config.yamlships traces to Jaeger by default. For Datadog, add or replace the exporter:otel-collector-config.yaml exporters:datadog:api:site: datadoghq.eu # or datadoghq.com for USkey: ${DD_API_KEY}service:pipelines:traces:receivers: [otlp]processors: [batch]exporters: [datadog]metrics:receivers: [otlp]processors: [batch]exporters: [datadog]The
otlpreceiver accepts data from services on gRPC (port 4317) and HTTP (port 4318). No changes to service code are required. -
Set environment variables
Each service needs to know where to send telemetry. These variables are set in the service’s Terraform or container configuration:
Terminal window OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317OTEL_EXPORTER_OTLP_HEADERS=dd-api-key=<your-api-key>OTEL_SERVICE_NAME=catalog-commercetoolsThe
OTEL_SERVICE_NAMEmaps to the Datadog service name in APM. Use the same name as your component for consistency. TheOTEL_EXPORTER_OTLP_HEADERSvariable passes authentication headers to the Collector or directly to Datadog’s OTLP endpoint.Services initialize OTel through
initObservability()in theirrun.tsentry point. This function configures the OpenTelemetry SDK, sets up the OTLP exporter (gRPC or HTTP based onOTEL_EXPORTER_OTLP_PROTOCOL), and optionally integrates with Sentry for error tracking. -
Configure Mach Composer
Add the Datadog API key to your SOPS-encrypted secrets file:
# config/<cloud>/tst.secrets.yamlsecrets:datadog:api_key: <your-datadog-api-key> # encrypted by SOPSThen reference the secret in your Mach Composer environment config and pass it to all components as a global secret and variable:
# config/<cloud>/tst.yamlglobal:variables:otel_exporter_otlp_endpoint: "https://your-otel-collector-endpoint"secrets:datadog_api_key: ${var.secrets.datadog.api_key} -
Wire the Terraform variables
Each service’s Terraform receives the secret through
var.secretsand injects it as environment variables inlocals.tf:locals {env_vars = {OTEL_EXPORTER_OTLP_ENDPOINT = var.variables.otel_exporter_otlp_endpointOTEL_EXPORTER_OTLP_HEADERS = "dd-api-key=${var.secrets.datadog_api_key}"OTEL_SERVICE_NAME = local.service_name}}Follow the existing patterns in
backend/services/catalog-commercetools/terraform/aws/locals.tf(or the equivalent Azure/GCP directory) to see how other observability secrets are injected. -
Verify traces and metrics
After deploying the updated Collector:
- Open the Datadog APM page and look for your service names
- Trigger a request through the storefront and check that a distributed trace appears spanning the gateway and backend services
- Check the Metrics Explorer for OTel metrics (request duration, error rate)
If traces do not appear, check the Collector logs for export errors and verify that the API key and site are correct.
-
Add Core Web Vitals (optional)
Evolve’s frontend reports Core Web Vitals through OTel. These metrics flow through the same Collector pipeline, so they appear in Datadog automatically once the exporter is configured. You can build dashboards tracking LCP, FID, and CLS per page and per deployment.
Further reading
Section titled “Further reading”- Observability for the full OTel architecture, local development setup, and Core Web Vitals monitoring
- SaaS configuration for managing third-party service credentials through Terraform

