Repository navigation
fix(otel): treat empty OTEL_* environment variables as unset - #9497
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
The new theory fails on older supported .NET runtimes because setting an empty environment value deletes the variable, contradicting the DD_SERVICE assertion. The same setup leaves empty-OTEL normalization untested on those runtimes.
🤖 Bits Code Review · Commit 4017510
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (9497) and master. ✅ No regressions detected |
BenchmarksBenchmark execution time: 2026-10-29 14:52:10 Comparing candidate commit 3c299e7 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 72 metrics, 0 unstable metrics, 7 known flaky benchmarks, 118 flaky benchmarks without significant changes.
|
… P3 /sdk-review finding)
anna-git
left a comment
There was a problem hiding this comment.
last nit comment but LGTM thanks!
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary of changes
Empty
OTEL_*environment variables are now treated as unset byEnvironmentConfigurationSource.Reason for change
The OpenTelemetry spec requires an empty environment variable to be interpreted the same way as an unset one. The tracer read it as
"", so e.g.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=""did not fall back toOTEL_EXPORTER_OTLP_PROTOCOL(system-testsTest_OTEL_EXPORTER_OTLP_LOGS_PROTOCOL::test_generic_fallback[empty-generic-nondefault-logs]).Jira: APMAPI-2479
Implementation details
EnvironmentConfigurationSource.GetStringreturnsnullfor an empty value when the key starts withOTEL_, so the composite source and fallbacks behave as if the variable were not set. The change is limited to env vars (the scope of the spec rule) and toOTEL_*keys, soDD_*behavior is unchanged. Whitespace-only values are still passed through.Test coverage
Added
ConfigurationSourceTests.EnvironmentConfigurationSource_EmptyOtelValueIsUnset(empty-value cases are skipped on runtimes where setting a variable to an empty value removes it: Windows and .NET 8 or earlier).Other details
Empty
OTEL_*values are no longer reported in configuration telemetry, and anyOTEL_*setting that previously received""now falls back to its Datadog equivalent or default.