Skip to content

Match environment variables for underscore keys in DefaultConfigProperties - #8951

Draft
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/default-config-properties-env-var-underscore-keys
Draft

thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/default-config-properties-env-var-underscore-keys

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Related to #8932. Follow-up to #8933, which fixes the same mismatch in ConfigUtil.getString.

Description

  • DefaultConfigProperties stored environment variable keys with _ replaced by ., but kept _ for all other keys and lookups.
  • So OTEL_JAVA_EXPORTER_MEMORY_MODE was ignored: stored as otel.java.exporter.memory.mode, looked up as otel.java.exporter.memory_mode.
  • Normalize every stored and looked-up key the same way (lower case, - and _ replaced with .), and update the class Javadoc. Keys without _ behave as before.
  • All sources now write to the same key, so the documented priority holds: system properties over environment variables over defaultProperties, with withOverrides on top.
  • a_b and a.b now map to the same key, as environment variables already did.

Testing done

  • Added three ConfigPropertiesTest cases with OTEL_JAVA_EXPORTER_MEMORY_MODE=immutable_data set in the module's test task: env var only, env var over default, system property over env var.
  • The first two fail without the fix (null and "reusable_data").
  • ./gradlew :sdk-extensions:autoconfigure-spi:check passed (19 tests).
  • ./gradlew :sdk-extensions:autoconfigure:check :exporters:otlp:all:test passed (198 and 117 tests).

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-10-17 02:30 UTC

Move out of draft to request review.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.65%. Comparing base (4662b08) to head (53b050c).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8951      +/-   ##
============================================
+ Coverage     90.61%   90.65%   +0.04%     
- Complexity    10882    10889       +7     
============================================
  Files          1015     1015              
  Lines         29731    29731              
  Branches       3876     3876              
============================================
+ Hits          26942    26954      +12     
+ Misses         1872     1860      -12     
  Partials        917      917              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant