dd-trace includes experimental support for OpenTelemetry metrics. It is designed as a drop-in replacement for the OpenTelemetry Metrics SDK and integrates with OTLP export infrastructure.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/datadog/dd-trace-js/llms.txt
Use this file to discover all available pages before exploring further.
This feature is experimental. Enable it by setting
DD_METRICS_OTEL_ENABLED=true.Setup
Instrument types
Counter
A monotonically increasing value. Use for counts of events.Histogram
Records distributions of values. Use for latencies, sizes, and other measured values.UpDownCounter
A counter that can increase or decrease. Use for values that go up and down, such as active connections.ObservableGauge
An asynchronous instrument for values observed at collection time. Use for current state values like CPU usage or memory.Full example
Configuration
The following environment variables control OpenTelemetry metrics behavior:| Variable | Default | Description |
|---|---|---|
DD_METRICS_OTEL_ENABLED | false | Enable OpenTelemetry metrics support |
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT | http://localhost:4318/v1/metrics | OTLP endpoint for metrics. Falls back to OTEL_EXPORTER_OTLP_ENDPOINT + /v1/metrics |
OTEL_EXPORTER_OTLP_METRICS_HEADERS | {} | Headers for metrics requests (JSON format). Falls back to OTEL_EXPORTER_OTLP_HEADERS |
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL | http/protobuf | OTLP protocol. Options: http/protobuf, http/json. Falls back to OTEL_EXPORTER_OTLP_PROTOCOL |
OTEL_EXPORTER_OTLP_METRICS_TIMEOUT | 10000 | Request timeout in ms. Falls back to OTEL_EXPORTER_OTLP_TIMEOUT |
OTEL_METRIC_EXPORT_INTERVAL | 10000 | Export interval in ms |
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE | DELTA | Aggregation temporality. Options: CUMULATIVE, DELTA, LOWMEMORY |
OTEL_BSP_MAX_QUEUE_SIZE | 2048 | Maximum metrics to queue before dropping |
