Skip to content

Add support for escaping declarative config env var substitution #7033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 11, 2025

Conversation

jack-berg
Copy link
Member

@jack-berg jack-berg commented Jan 17, 2025

Implementation of spec PR: open-telemetry/opentelemetry-specification#4375

# given STR=val
key: ${STR}                           # yields key: val
key: ${UNKNOWN:-val}        # yields key: val
key: $${STR}                         # yields key: ${STR}   <-- NEW
key: $${UNKNOWN:-val}      # yields key: ${UNKNOWN:-val} <-- NEW

@jack-berg jack-berg requested a review from a team as a code owner January 17, 2025 23:02
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.96%. Comparing base (9cb6365) to head (a17bd3e).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7033      +/-   ##
============================================
+ Coverage     89.92%   89.96%   +0.03%     
- Complexity     6721     6723       +2     
============================================
  Files           765      765              
  Lines         20277    20293      +16     
  Branches       1985     1990       +5     
============================================
+ Hits          18234    18256      +22     
+ Misses         1448     1441       -7     
- Partials        595      596       +1     

☔ View full report in Codecov by Sentry.
📢 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.

@tsloughter
Copy link
Member

tsloughter commented Jan 22, 2025

Oh, now I see the collector uses $$. Then I suppose this is the way to go. May want to also mention additional escaping like allowing \$${DOLLARS} to be $10?

(Oops, had too many tabs open. This was supposed to be on the issue in the spec.)

@jack-berg jack-berg force-pushed the escape-env-var-substitution branch from 754d539 to 940dc1a Compare January 22, 2025 18:23
jack-berg added a commit to open-telemetry/opentelemetry-specification that referenced this pull request Jan 31, 2025
…4375)

Resolves #3914. 

An environment variable substitution reference which starts with `$$`
(i.e. `$${API_KEY}`) is escaped. Implementations should strip the
leading `$` character and not perform substitution (i.e. `$${API_KEY} =>
${API_KEY}`).

See java implementation here:
open-telemetry/opentelemetry-java#7033
Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing @jaydeluca!

@jack-berg jack-berg merged commit dc0b4ac into open-telemetry:main Apr 11, 2025
28 checks passed
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.

4 participants