You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(otel): honor DD_TRACE_OTEL_ENABLED=false and OTEL_SDK_DISABLED=false (#8219)
* fix(otel): honor DD_TRACE_OTEL_ENABLED=false and OTEL_SDK_DISABLED=false
`otel-sdk-trace.js` and the `otel_enabled` telemetry tag in
`opentracing/span.js` checked these env vars for raw truthiness, which
made the string `'false'` itself truthy and mishandled the OTel spec's
positive opt-in form (`OTEL_SDK_DISABLED=false`). Replace the truthiness
check with explicit precedence: the Datadog opt-out
(`DD_TRACE_OTEL_ENABLED=false`) wins over every OTel signal, then the
OTel opt-out (`OTEL_SDK_DISABLED=true`) wins over the opt-in side, then
either explicit opt-in enables it; otherwise stay disabled by default.
Fixes: #4873
* refactor(span): read config off the parent tracer
DatadogSpan was reading `DD_TRACE_OTEL_ENABLED`, the experimental
flags, and `DD_TRACE_SPAN_LEAK_DEBUG` from `getValueFromEnvSources` at
module load. Anything that updated those values through the Config
singleton (remote config, programmatic options) never reached the span
gates because the gates had captured the env-time value. Read them off
`tracer._config` instead — the opentracing tracer already holds the
singleton.
Three coordinated pieces:
1. Convert `_parentTracer` to a `#parentTracer` private field. There
are no external readers; `tracer()` is the public accessor. While
in the file, fix three sites that were reading from a non-existent
`this._tracer`.
2. Drop the comment block above the span-leak gate. It justified the
`tracer?._config?.X` nullish chain that this refactor replaces.
3. The four spec files constructing `new DatadogSpan(...)` with
`tracer = {}` (or `null`, or `{}` inline) now pass
`tracer = { _config: getConfig() }`. The two
`tracePropagationBehaviorExtract` overrides spread the real config
so the constructor's other reads see real defaults.
Drive-by fix:
* Drop a long-dead commented-out `registry.register` line in
spanleak.js, and the unused `operationName` argument span.js was
passing to `addSpan(span)`.
0 commit comments