Skip to content
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

Add support for escaping declarative config env var substitution #7033

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

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 (31869a3) to head (9e09cd9).
Report is 19 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7033      +/-   ##
============================================
+ Coverage     89.88%   89.96%   +0.07%     
- Complexity     6655     6668      +13     
============================================
  Files           748      748              
  Lines         20077    20121      +44     
  Branches       1969     1975       +6     
============================================
+ Hits          18047    18101      +54     
+ Misses         1435     1427       -8     
+ Partials        595      593       -2     

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

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

2 participants