Skip to content

Match environment variables for config keys containing underscores - #8933

Open
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/configutil-env-var-underscore-keys
Open

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

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #8932

Description

  • ConfigUtil.getString normalized the lookup key with normalizePropertyKey (keeps _) but env var names with normalizeEnvironmentVariableKey (turns _ into .), so keys containing _ never matched an env var.
  • So OTEL_EXPERIMENTAL_SDK_JVM_STACKTRACE=true was ignored, while the system property otel.experimental.sdk.jvm_stacktrace worked.
  • Normalize the lookup key with normalizeEnvironmentVariableKey before comparing it with env var names. Keys without _ behave the same as before.
  • System property matching and priority are unchanged.
  • Updated the getString Javadoc to match.

Testing done

  • Added a config_key assertion to ConfigUtilTest#getString_EnvironmentVariable (the build sets CONFIG_KEY=environment). It fails without the fix ("default") and passes with it.
  • ./gradlew :common:check passed (9 tests).
  • ./gradlew :sdk:common:test passed (346 tests).

@thswlsqls
thswlsqls marked this pull request as ready for review October 12, 2026 02:13
@thswlsqls
thswlsqls requested a review from a team as a code owner October 12, 2026 02:13
@opentelemetry-pr-dashboard

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

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-10-12 02:38 UTC

Review the latest changes.

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 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.65%. Comparing base (387f5c5) to head (95ac981).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8933   +/-   ##
=========================================
  Coverage     90.65%   90.65%           
  Complexity    10887    10887           
=========================================
  Files          1015     1015           
  Lines         29731    29733    +2     
  Branches       3876     3876           
=========================================
+ Hits          26953    26955    +2     
  Misses         1860     1860           
  Partials        918      918           

☔ 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.

Environment variables are ignored for config keys containing underscores

1 participant