Repository navigation
Conversation
Pull request dashboard statusWaiting on reviewers · refreshed 2026-10-21 20:00 UTC Review the latest changes. Status above doesn't look right?
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation and regression coverage support the described behavior, with no unresolved blocking issues.
No open issues 🎉
What changed in this PR
Aligns declarative configuration environment-variable substitution with the specification.
Changes:
- Adds
env:support, escape-first parsing, invalid-reference errors, and defaults for empty variables. - Preserves YAML type resolution for standalone prefixed references.
- Expands unit and Docker scenario coverage.
| File | Description |
|---|---|
| tests/opentelemetry-docker-tests/tests/declconfig/scenarios/general_env_substitution/scenario.yaml | Expands expected substitution results. |
| tests/opentelemetry-docker-tests/tests/declconfig/scenarios/general_env_substitution/otel-config.yaml | Adds substitution edge cases. |
| tests/opentelemetry-docker-tests/tests/declconfig/scenarios/error_invalid_env_substitution/scenario.yaml | Checks initialization failure and zero spans. |
| tests/opentelemetry-docker-tests/tests/declconfig/scenarios/error_invalid_env_substitution/run.py | Attempts tracing after invalid configuration. |
| tests/opentelemetry-docker-tests/tests/declconfig/scenarios/error_invalid_env_substitution/otel-config.yaml | Supplies an invalid reference. |
| opentelemetry-configuration/tests/file/test_loader.py | Tests loader typing and error propagation. |
| opentelemetry-configuration/tests/file/test_env_substitution.py | Adds specification regression tests. |
| opentelemetry-configuration/src/opentelemetry/configuration/file/_loader.py | Recognizes standalone prefixed references. |
| opentelemetry-configuration/src/opentelemetry/configuration/file/_env_substitution.py | Implements updated substitution rules. |
| .changelog/5805.fixed | Records the parsing fix. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Aligns environment variable substitution in
opentelemetry-configurationwith the declarative configuration spec.${env:VALUE}(VALUE=42, unquoted)42, resolved as an int${VALUE:?error},${1API_KEY},${sys:foo}ConfigurationError, no partial config${UNDEFINED_KEY:-$${UNDEFINED_KEY}}$${UNDEFINED_KEY}${UNDEFINED_KEY:-${UNDEFINED_KEY}}${EMPTY:-fallback}withEMPTY=""""fallbackChanges:
$$escapes are now found first, scanning left to right, and references are matched only in the text between them, as in the spec's pseudocode.env:prefix. An unquoted standalone${env:VAR}gets the same YAML type resolution as${VAR}.ENV-SUBSTITUTIONnow raisesConfigurationError. This includes unknown prefixes, sinceenv:is the only one this SDK supports.Type of change
Please delete options that are not relevant.
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.
tox -e precommittox -e typecheck