Skip to content

Commit 708fb09

Browse files
authored
Clarify SDK precedence and warn against using OTel and DD settings. (#33570)
* Clarify SDK precedence and warn against using OTel and DD settings. * Extra cleanup.
1 parent ef39daa commit 708fb09

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

content/en/opentelemetry/config/environment_variable_support.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ Datadog SDKs implement the OpenTelemetry APIs for traces, metrics, and logs. Thi
3333

3434
This page describes the environment variables Datadog supports for OpenTelemetry interoperability.
3535

36-
<div class="alert alert-info">If both Datadog and OpenTelemetry environment variables are set, Datadog takes precedence. Datadog defaults also override OpenTelemetry defaults. See the relevant <a href="/tracing/trace_collection/library_config/">SDK Configuration page</a> for default values and more information.</div>
36+
The precedence rules on this page describe how *Datadog SDKs* resolve configuration into OpenTelemetry resource attributes (for example, `service.name`, `deployment.environment.name`, `service.version`).
37+
38+
<div class="alert alert-danger">
39+
To avoid duplicate values appearing in Datadog for the same tag key, don't set both Datadog (<code>DD_*</code>) and OpenTelemetry (<code>OTEL_*</code>) environment variables for the same concept. Choose one convention.
40+
<br>
41+
See the relevant <a href="/tracing/trace_collection/library_config/">SDK Configuration page</a> for default values and more information.
42+
</div>
3743

3844
## Datadog SDK configuration
3945
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][14].
@@ -47,10 +53,6 @@ These environment variables enable the Datadog SDK to ingest OpenTelemetry Metri
4753
: **Description**: Enables the automatic instrumentation components of the Datadog SDK to collect and emit metrics generated by the OTel Metrics API. <br>
4854
**Default**: `false`
4955

50-
`DD_LOGS_OTEL_ENABLED`
51-
: **Description**: Enables the Datadog SDK's native OpenTelemetry Logs API implementation, allowing logs to be collected and exported in OTLP format. <br>
52-
**Default**: `false`
53-
5456
`DD_LOGS_OTEL_ENABLED`
5557
: **Description**: Enables the Datadog SDK to collect and export logs in the OTLP format. <br>
5658
**Notes**: For most languages, this enables support for the OTel Logs API. For .NET, this enables interception of built-in loggers. <br>
@@ -62,7 +64,7 @@ Datadog SDKs support the following general OpenTelemetry SDK options. For more i
6264
`OTEL_SERVICE_NAME`
6365
: **Datadog convention**: `DD_SERVICE`<br>
6466
Sets the `service.name` resource attribute<br>
65-
**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.<br>
67+
**Notes**: When determining the final `service.name` resource attribute, the SDK uses this variable as an input to determine the final `service.name`. See the `service.name` notes under `OTEL_RESOURCE_ATTRIBUTES` for the complete precedence order.<br>
6668

6769
`OTEL_LOG_LEVEL`
6870
: **Datadog convention**: `DD_LOG_LEVEL`<br>
@@ -104,27 +106,32 @@ Trace exporter to be used<br>
104106

105107
`OTEL_RESOURCE_ATTRIBUTES`
106108
: **Datadog convention**: `DD_TAGS` <br>
107-
**Description**: Key-value pairs to be used as resource attributes. <br>
108-
**Notes**: Datadog-defined configurations take precedence.
109-
- `service.name` (maps to `DD_SERVICE`): Resolved with the following precedence: <br>
109+
**Description**: Key-value pairs to be used as OpenTelemetry resource attributes. <br>
110+
**Notes**: The SDK resolves overlapping settings using Datadog (`DD_*`) configuration first.
111+
- `service.name` (maps to `DD_SERVICE`): The SDK resolves the value with the following precedence: <br>
110112
1. Value of `DD_SERVICE` <br>
111113
2. Value of `service` key in `DD_TAGS` <br>
112114
3. Value of `OTEL_SERVICE_NAME` <br>
113115
4. Value of `service.name` key in `OTEL_RESOURCE_ATTRIBUTES`
114-
- `deployment.environment.name` (maps to `DD_ENV`): Resolved with the following precedence: <br>
116+
- `deployment.environment.name` (maps to `DD_ENV`): The SDK resolves the value with the following precedence: <br>
115117
1. Value of `DD_ENV` <br>
116118
2. Value of `env` key in `DD_TAGS` <br>
117119
3. Value of `deployment.environment.name` key in `OTEL_RESOURCE_ATTRIBUTES` <br>
118120
4. Value of `deployment.environment` in `OTEL_RESOURCE_ATTRIBUTES`
119-
- `service.version` (maps to `DD_VERSION`): Resolved with the following precedence: <br>
121+
- `service.version` (maps to `DD_VERSION`): The SDK resolves the value with the following precedence: <br>
120122
1. Value of `DD_VERSION` <br>
121123
2. Value of `version` key in `DD_TAGS` <br>
122124
3. Value of `service.version` key in `OTEL_RESOURCE_ATTRIBUTES`
123125
- **Additional Attributes**: May be added through the `DD_TAGS` configuration, or `OTEL_RESOURCE_ATTRIBUTES` if `DD_TAGS` is not set.
124126

127+
<div class="alert alert-danger">
128+
Although the SDK resolves these settings internally for emitted telemetry, the Datadog Agent collects tags from all configured sources without overriding. Configuring service/environment/version using multiple inputs (for example, both <code>DD_ENV</code> and <code>OTEL_RESOURCE_ATTRIBUTES</code>) can result in multiple values appearing in Datadog (for example, <code>env:prod</code> and <code>env:dev</code>).
129+
To avoid duplicates, configure each concept using only one convention.
130+
</div>
131+
125132
`OTEL_SDK_DISABLED`
126133
: **Description**: Disables the Datadog SDK's OpenTelemetry interoperability for all signals. <br>
127-
**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`.<br>
134+
**Notes**: When set to `true`, this effectively sets `DD_TRACE_OTEL_ENABLED=false`, `DD_LOGS_OTEL_ENABLED=false`, and `DD_METRICS_OTEL_ENABLED=false`.<br>
128135
**Ruby & Go SDKs**: The OpenTelemetry SDK activates automatically upon import and configuration, so this setting is not applicable.
129136

130137
## OTLP Exporter configuration
@@ -298,4 +305,4 @@ A comma-separated list of paths to extension jar files, or folders containing ja
298305
[13]: https://opentelemetry.io/docs/specs/otel/protocol/exporter/
299306
[14]: /opentelemetry/instrument/api_support/
300307
[15]: https://opentelemetry.io/docs/specs/otel/metrics/sdk_exporters/otlp/#additional-environment-variable-configuration
301-
[16]: /opentelemetry/guide/otlp_delta_temporality/
308+
[16]: /opentelemetry/guide/otlp_delta_temporality/

0 commit comments

Comments
 (0)