Repository navigation
Match environment variables for underscore keys in DefaultConfigProperties - #8951
Conversation
Pull request dashboard statusMerged · refreshed 2026-11-03 15:36 UTC Status above doesn't look right?
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
jack-berg
left a comment
There was a problem hiding this comment.
This does have some behavior changes as described in the table below. However I think its acceptable and the existing behavior should be classified as a bug.
With this PR, the summary of sys property / env var behavior is: Property names and lookup keys are case-insensitive and treat ., _, and - equivalently. Standard underscore-separated environment variables map to those same keys.
| Environment variable | System property | Lookup key | Before | After |
|---|---|---|---|---|
OTEL_JAVA_EXPORTER_MEMORY_MODE=immutable_data |
None | otel.java.exporter.memory_mode |
null |
immutable_data |
A_B=ENV |
None | a_b |
null |
ENV |
A_B=ENV |
None | a.b |
ENV |
ENV |
A_B=ENV |
None | a-b |
ENV |
ENV |
| None | -Da_b=SYS |
a_b |
SYS |
SYS |
| None | -Da_b=SYS |
a.b |
null |
SYS |
| None | -Da_b=SYS |
a-b |
null |
SYS |
| None | -Da.b=SYS |
a_b |
null |
SYS |
| None | -Da.b=SYS |
a.b |
SYS |
SYS |
| None | -Da.b=SYS |
a-b |
SYS |
SYS |
| None | -Da-b=SYS |
a_b |
null |
SYS |
| None | -Da-b=SYS |
a.b |
SYS |
SYS |
A_B=ENV |
-Da_b=SYS |
a_b |
SYS |
SYS |
A_B=ENV |
-Da_b=SYS |
a.b |
ENV |
SYS |
A_B=ENV |
-Da_b=SYS |
a-b |
ENV |
SYS |
A_B=ENV |
-Da.b=SYS |
a_b |
null |
SYS |
A_B=ENV |
-Da.b=SYS |
a.b |
SYS |
SYS |
Heads up @open-telemetry/java-approvers. Will merge on 11/3 if no other feedback.
|
Thank you for your contribution @thswlsqls! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. |
Related to #8932. Follow-up to #8933, which fixes the same mismatch in
ConfigUtil.getString.Description
DefaultConfigPropertiesstored environment variable keys with_replaced by., but kept_for all other keys and lookups.OTEL_JAVA_EXPORTER_MEMORY_MODEwas ignored: stored asotel.java.exporter.memory.mode, looked up asotel.java.exporter.memory_mode.-and_replaced with.), and update the class Javadoc. Keys without_behave as before.defaultProperties, withwithOverrideson top.a_banda.bnow map to the same key, as environment variables already did.Testing done
ConfigPropertiesTestcases withOTEL_JAVA_EXPORTER_MEMORY_MODE=immutable_dataset in the module's test task: env var only, env var over default, system property over env var.nulland"reusable_data")../gradlew :sdk-extensions:autoconfigure-spi:checkpassed (19 tests)../gradlew :sdk-extensions:autoconfigure:check :exporters:otlp:all:testpassed (198 and 117 tests).