OpenTelemetry Environment Variables Interoperability
Datadog SDKs implement the OpenTelemetry APIs for traces, metrics, and logs. This allows you to use standard OpenTelemetry environment variables to configure your application while receiving additional Datadog telemetry with minimal changes to your existing configuration.
This page describes the environment variables Datadog supports for OpenTelemetry interoperability.
If both Datadog and OpenTelemetry environment variables are set, Datadog takes precedence. Datadog defaults also override OpenTelemetry defaults. See the relevant
SDK Configuration page for default values and more information.
Datadog SDK configuration
These environment variables enable the Datadog SDK to ingest OpenTelemetry Metrics and Logs API data. For guides on how to instrument your application, see the language-specific instrumentation documentation.
DD_TRACE_OTEL_ENABLED- Description: Enables the Datadog SDK’s OpenTelemetry interoperability for traces.
Default: false
Notes: The default is true in the Java SDK. DD_METRICS_OTEL_ENABLED- Description: Enables the automatic instrumentation components of the Datadog SDK to collect and emit metrics generated by the OTel Metrics API.
Default: false DD_LOGS_OTEL_ENABLED- Description: Enables the Datadog SDK’s native OpenTelemetry Logs API implementation, allowing logs to be collected and exported in OTLP format.
Default: false DD_LOGS_OTEL_ENABLED- Description: Enables the Datadog SDK to collect and export logs in the OTLP format.
Notes: For most languages, this enables support for the OTel Logs API. For .NET, this enables interception of built-in loggers.
Default: false
General SDK configuration
Datadog SDKs support the following general OpenTelemetry SDK options. For more information, see the related OpenTelemetry documentation.
OTEL_SERVICE_NAME- Datadog convention:
DD_SERVICE
Sets the service.name resource attribute
Notes: This variable is one of several used to determine the final service name. See the service.name notes under OTEL_RESOURCE_ATTRIBUTES for the complete precedence order.
OTEL_LOG_LEVEL- Datadog convention:
DD_LOG_LEVEL
Log level used by the SDK logger
Notes: A log level of debug also maps to DD_TRACE_DEBUG=true
In the Node.js & PHP SDKs this maps to DD_TRACE_LOG_LEVEL
In the Go SDK only mapped values between OTEL_LOG_LEVEL & DD_TRACE_DEBUG are supported:
info|falsedebug|true
Not Supported In: Python, .NET, Ruby, and Go SDKs
OTEL_PROPAGATORS- Datadog convention:
DD_TRACE_PROPAGATION_STYLE
Propagators to be used as a comma-separated list
Notes: The only supported values for most Datadog SDKs are tracecontext, b3, b3multi, none, datadog. xray is also supported for the Java SDK
Values must be deduplicated to register a Propagator only once
OTEL_TRACES_SAMPLER & OTEL_TRACES_SAMPLER_ARG- Datadog convention:
DD_TRACE_SAMPLE_RATE
OTEL_TRACES_SAMPLER: Sampler to be used for traces & OTEL_TRACES_SAMPLER_ARG: String value to be used as the sampler argument
Notes: The specified value is only used if OTEL_TRACES_SAMPLER is set. Each Sampler type defines its own expected input, if any. Invalid or unrecognized input MUST be logged and MUST be otherwise ignored. In such cases, the implementation MUST behave as if OTEL_TRACES_SAMPLER_ARG is not set
Mapped values between OTEL_TRACES_SAMPLER & DD_TRACE_SAMPLE_RATE:
parentbased_always_on|1.0parentbased_always_off|0.0parentbased_traceidratio|${OTEL_TRACES_SAMPLER_ARG}always_on|1.0always_off|0.0traceidratio|${OTEL_TRACES_SAMPLER_ARG}
OTEL_TRACES_EXPORTER- Datadog convention:
DD_TRACE_ENABLED=false
Trace exporter to be used
Notes: Only a value of none is accepted
OTEL_METRICS_EXPORTER- Description: Specifies the metrics exporter to be used.
Notes: The only accepted values are otlp and none. A value of none disables the emission of OTel metrics, as well as APM runtime metrics (equivalent to DD_RUNTIME_METRICS_ENABLED=false)
Default: otlp OTEL_RESOURCE_ATTRIBUTES- Datadog convention:
DD_TAGS
Description: Key-value pairs to be used as resource attributes.
Notes: Datadog-defined configurations take precedence.service.name (maps to DD_SERVICE): Resolved with the following precedence:
- Value of
DD_SERVICE
- Value of
service key in DD_TAGS
- Value of
OTEL_SERVICE_NAME
- Value of
service.name key in OTEL_RESOURCE_ATTRIBUTES
deployment.environment.name (maps to DD_ENV): Resolved with the following precedence:
- Value of
DD_ENV
- Value of
env key in DD_TAGS
- Value of
deployment.environment.name key in OTEL_RESOURCE_ATTRIBUTES
- Value of
deployment.environment in OTEL_RESOURCE_ATTRIBUTES
service.version (maps to DD_VERSION): Resolved with the following precedence:
- Value of
DD_VERSION
- Value of
version key in DD_TAGS
- Value of
service.version key in OTEL_RESOURCE_ATTRIBUTES
- Additional Attributes: May be added through the
DD_TAGS configuration, or OTEL_RESOURCE_ATTRIBUTES if DD_TAGS is not set.
OTEL_SDK_DISABLED- Description: Disables the Datadog SDK’s OpenTelemetry interoperability for all signals.
Notes: Notes: When set to true, this effectively sets DD_TRACE_OTEL_ENABLED=false, DD_LOGS_OTEL_ENABLED=false, and DD_METRICS_OTEL_ENABLED=false.
Ruby & Go SDKs: The OpenTelemetry SDK activates automatically upon import and configuration, so this setting is not applicable.
OTLP Exporter configuration
Datadog SDKs support the following OpenTelemetry OTLP Exporter options.
Signal-specific variables (like OTEL_EXPORTER_OTLP_METRICS_PROTOCOL) always take precedence over their general counterparts (like OTEL_EXPORTER_OTLP_PROTOCOL).
General OTLP configuration
OTEL_EXPORTER_OTLP_PROTOCOL- Description: Specifies the transport protocol to use for all signals unless overridden.
Accepted values: grpc, http/protobuf, http/json.
Default: SDK-dependent. The Datadog SDK aims to match the default protocol of the corresponding official OpenTelemetry SDK for that language. OTEL_EXPORTER_OTLP_ENDPOINT- Description: Specifies the base URL for sending OTLP data for all signals unless overridden.
Default (gRPC): http://localhost:4317.
Default (HTTP): http://localhost:4318. OTEL_EXPORTER_OTLP_HEADERS- Description: Specifies a comma-separated list of key-value pairs to be used as headers on all outgoing OTLP requests (for example,
api-key=key,other-config=value). OTEL_EXPORTER_OTLP_TIMEOUT- Description: Specifies the timeout (in milliseconds) for all outgoing OTLP requests unless overridden.
Default: 10000 (10s).
Metrics-specific OTLP configuration
For more details on the official specification for these variables, see the OpenTelemetry OTLP Metrics Exporter documentation.
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL- Description: Specifies the OTLP transport protocol to use for metrics data. Takes precedence over the general
OTEL_EXPORTER_OTLP_PROTOCOL.
Accepted values: grpc, http/protobuf, http/json.
Default: SDK-dependent. The Datadog SDK aims to match the default protocol of the corresponding official OpenTelemetry SDK for that language. OTEL_EXPORTER_OTLP_METRICS_ENDPOINT- Description: Specifies the URL for sending OTLP metrics data. Takes precedence over the general
OTEL_EXPORTER_OTLP_ENDPOINT.
Default (gRPC): http://localhost:4317.
Default (HTTP): http://localhost:4318/v1/metrics.
Notes: For HTTP protocols, the SDK will automatically append /v1/metrics if the general OTEL_EXPORTER_OTLP_ENDPOINT is used as a fallback. OTEL_EXPORTER_OTLP_METRICS_HEADERS- Description: Specifies a comma-separated list of key-value pairs to be used as headers on outgoing OTLP metrics requests (for example,
api-key=key,other-config=value). Takes precedence over the general OTEL_EXPORTER_OTLP_HEADERS. OTEL_EXPORTER_OTLP_METRICS_TIMEOUT- Description: Specifies the timeout (in milliseconds) for a single outgoing OTLP metrics request. Takes precedence over the general
OTEL_EXPORTER_OTLP_TIMEOUT.
Default: 10000 (10s).
Logs-specific OTLP configuration
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL- Description: Specifies the OTLP transport protocol for logs. Takes precedence over
OTEL_EXPORTER_OTLP_PROTOCOL. - Accepted values:
grpc, http/protobuf, http/json
- Default: SDK-dependent. The Datadog SDK aims to match the default protocol of the corresponding official OpenTelemetry SDK for that language.
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT- Description: Specifies the URL for sending OTLP logs. Takes precedence over
OTEL_EXPORTER_OTLP_ENDPOINT. - Default (gRPC):
http://localhost:4317 - Default (HTTP):
http://localhost:4318/v1/logs OTEL_EXPORTER_OTLP_LOGS_HEADERS- Description: Specifies a comma-separated list of key-value pairs to be used as headers on outgoing OTLP logs requests. Takes precedence over the general
OTEL_EXPORTER_OTLP_HEADERS. OTEL_EXPORTER_OTLP_LOGS_TIMEOUT- Description: Specifies the timeout (in milliseconds) for a single outgoing OTLP logs request. Takes precedence over the general
OTEL_EXPORTER_OTLP_TIMEOUT.
Default: 10000 (10s).
OpenTelemetry Metrics SDK configuration
Datadog SDKs support the following OpenTelemetry Metrics SDK options.
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE- Description: Specifies the aggregation
temporality to use for each instrument kind.
Accepted values: Cumulative, Delta, LowMemory. For more details, see the OpenTelemetry specification.
Default: delta
Notes: This default value delta is Datadog’s recommended configuration and differs from the OpenTelemetry specification’s default. OTEL_METRIC_EXPORT_INTERVAL- Description: Specifies the time interval (in milliseconds) between metric export attempts.
Default: 10000 (10s)
Notes: This default value is Datadog’s recommended configuration and differs from the OpenTelemetry specification’s default of 60000ms. OTEL_METRIC_EXPORT_TIMEOUT- Description: Specifies the maximum allowed time (in milliseconds) to collect and export metrics.
Default: 7500 (7.5s)
Notes: This default value is Datadog’s recommended configuration and differs from the OpenTelemetry specification’s default of 30000ms.
OpenTelemetry Logs SDK configuration
Datadog SDKs support the following OpenTelemetry Logs SDK options.
OTEL_LOGS_EXPORTER- Description: Specifies the logs exporter to be used.
Accepted values: otlp, none. A value of none disables the emission of OTel logs.
Default: otlp OTEL_BLRP_MAX_QUEUE_SIZE- Description: The maximum number of log records to hold in memory. New records are dropped when the limit is reached.
Default: 2048 OTEL_BLRP_SCHEDULE_DELAY- Description: The time interval (in milliseconds) between two consecutive export operations.
Default: 1000 (1s) OTEL_BLRP_EXPORT_TIMEOUT- Description: The maximum duration (in milliseconds) allowed for a single export before cancellation.
Default: 30000 (30s) OTEL_BLRP_MAX_EXPORT_BATCH_SIZE- Description: The maximum number of log records in a single OTLP payload.
Default: 512
Java-specific configuration
Datadog SDKs support the following Java-specific OpenTelemetry configuration options. For more information, see the OpenTelemetry documentation on Java agent configuration.
OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED- Datadog convention:
!DD_INTEGRATIONS_ENABLED
Set to false to disable all instrumentation in the Agent
Notes: Mapped values between OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED & DD_INTEGRATIONS_ENABLED:
OTEL_INSTRUMENTATION_[NAME]_ENABLED- Description: Enables/disables the named OTel drop-in instrumentation
OTEL_JAVAAGENT_CONFIGURATION_FILE- Datadog convention:
DD_TRACE_CONFIG
Path to valid Java properties file which contains the agent configuration
Notes: When OTEL_JAVAAGENT_CONFIGURATION_FILE and DD_TRACE_CONFIG are both set we apply the configuration from both files. This is an exception to the usual rule where the Datadog setting overrides the OTel one
OTEL_INSTRUMENTATION_HTTP_CLIENT_CAPTURE_REQUEST_HEADERS- Datadog convention:
DD_TRACE_REQUEST_HEADER_TAGS
A comma-separated list of HTTP header names. HTTP client instrumentations capture HTTP request header values for all configured header names
Notes: Header tagging configured using OTel environment variables follows the OTel tag name convention of http.request.header.<header-name> rather than the Datadog convention of http.request.headers.<header-name>
OTEL_INSTRUMENTATION_HTTP_CLIENT_CAPTURE_RESPONSE_HEADERS- Datadog convention:
DD_TRACE_RESPONSE_HEADER_TAGS
A comma-separated list of HTTP header names. HTTP client instrumentations capture HTTP response header values for all configured header names
Notes: Header tagging configured using OTel environment variables follows the OTel tag name convention of http.response.header.<header-name> rather than the Datadog convention of http.response.headers.<header-name>
OTEL_INSTRUMENTATION_HTTP_SERVER_CAPTURE_REQUEST_HEADERS- Datadog convention:
DD_TRACE_REQUEST_HEADER_TAGS
A comma-separated list of HTTP header names. HTTP server instrumentations capture HTTP request header values for all configured header names
Notes: Header tagging configured using OTel environment variables follows the OTel tag name convention of http.request.header.<header-name> rather than the Datadog convention of http.request.headers.<header-name>
OTEL_INSTRUMENTATION_HTTP_SERVER_CAPTURE_RESPONSE_HEADERS- Datadog convention:
DD_TRACE_RESPONSE_HEADER_TAGS
A comma-separated list of HTTP header names. HTTP server instrumentations capture HTTP response header values for all configured header names
Notes: Header tagging configured using OTel environment variables follows the OTel tag name convention of http.response.header.<header-name> rather than the Datadog convention of http.response.headers.<header-name>
OTEL_JAVAAGENT_EXTENSIONS- Datadog convention:
DD_TRACE_EXTENSIONS_PATH
A comma-separated list of paths to extension jar files, or folders containing jar files. If pointing to a folder, every jar file in that folder is treated as a separate, independent extension.
Further Reading
Additional helpful documentation, links, and articles: