dd-trace includes experimental support for OpenTelemetry logs. It is designed as a drop-in replacement for the OpenTelemetry Logs SDK and emits structured log data.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_LOGS_OTEL_ENABLED=true.Setup
Emitting logs
Uselogger.emit() to emit structured log records:
Severity levels
OpenTelemetry severity numbers map to the following severity text values:severityNumber | severityText | Description |
|---|---|---|
| 1–4 | TRACE | Trace-level messages |
| 5–8 | DEBUG | Debug messages |
| 9–12 | INFO | Informational messages |
| 13–16 | WARN | Warnings |
| 17–20 | ERROR | Errors |
| 21–24 | FATAL | Fatal errors |
Full example
Configuration
The following environment variables control OpenTelemetry logs behavior:| Variable | Default | Description |
|---|---|---|
DD_LOGS_OTEL_ENABLED | false | Enable OpenTelemetry logs support |
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT | http://localhost:4318/v1/logs | OTLP endpoint for logs. Falls back to OTEL_EXPORTER_OTLP_ENDPOINT + /v1/logs |
OTEL_EXPORTER_OTLP_LOGS_HEADERS | {} | Headers for log requests (JSON format). Falls back to OTEL_EXPORTER_OTLP_HEADERS |
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL | http/protobuf | OTLP protocol. Options: http/protobuf, http/json. Falls back to OTEL_EXPORTER_OTLP_PROTOCOL |
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT | 10000 | Request timeout in ms. Falls back to OTEL_EXPORTER_OTLP_TIMEOUT |
OTEL_BSP_SCHEDULE_DELAY | 5000 | Batch export delay in ms |
OTEL_BSP_MAX_EXPORT_BATCH_SIZE | 512 | Maximum log records per batch |
OTEL_BSP_MAX_QUEUE_SIZE | 2048 | Maximum log records to queue before dropping |
