Substitute empty for unset config env vars without defaults - #5408
Merged
xrmx merged 5 commits intoJul 22, 2026
Conversation
ocelotl
marked this pull request as ready for review
July 13, 2026 02:04
ocelotl
force-pushed
the
issue_5405_unset_env_var_empty_value
branch
from
July 13, 2026 02:33
c108bb7 to
9697dea
Compare
MikeGoldsmith
previously requested changes
Jul 13, 2026
MikeGoldsmith
left a comment
Member
There was a problem hiding this comment.
Looks good. Left one comment regarding allowing empty substitute values which we'll need to resolve.
ocelotl
force-pushed
the
issue_5405_unset_env_var_empty_value
branch
from
July 16, 2026 02:42
1aa11c5 to
0700cf7
Compare
Declarative config environment variable substitution rejected any
${VAR} reference to an unset variable that had no default, raising a
ConfigurationError and preventing SDK initialization. The declarative
configuration spec requires an unset variable without a default to be
replaced with an empty value (which YAML then reads as null), matching
the Java and Node.js implementations and allowing config files to be
shared across languages.
Replace the raise with empty substitution. EnvSubstitutionError is kept
as public API for backward compatibility but is no longer raised.
Update tests accordingly.
Fixes open-telemetry#5405
…resource attributes Address review feedback on open-telemetry#5408: - Remove the now-unused EnvSubstitutionError class and its public export. Nothing raises it since unset variables substitute an empty value. - Skip resource attributes whose value resolves to null (an unset ${VAR} with no default) and log a warning, instead of inserting a None value or coercing it into garbage. create_resource and _coerce_attribute_value did not guard None, so before this the empty substitution would have propagated a null attribute value into the SDK Resource.
ocelotl
force-pushed
the
issue_5405_unset_env_var_empty_value
branch
from
July 20, 2026 21:06
0700cf7 to
cff2dea
Compare
…f removing EnvSubstitutionError shipped in the released 0.65b0, so removing it from the public API broke the public-symbols-check (griffe). Restore it as a public export marked with typing_extensions.deprecated; it is no longer raised now that an unset variable without a default substitutes an empty value. Declare typing-extensions as a direct dependency since it is now imported directly.
herin049
approved these changes
Jul 22, 2026
…set substitution Per review, the beta opentelemetry-configuration package may make breaking changes, so remove EnvSubstitutionError (and its now-unnecessary typing-extensions dependency) rather than deprecating it. The public-symbols check is bypassed via the 'Approve Public API check' label. Also simplify the unset-variable branch to 'return default_value or ""', which already covers the no-default case.
Contributor
Author
|
@open-telemetry/python-approvers Please skip public symbols check |
xrmx
approved these changes
Jul 22, 2026
xrmx
enabled auto-merge
July 22, 2026 12:36
xrmx
dismissed
MikeGoldsmith’s stale review
July 22, 2026 12:38
Mike feedback was incorporated in the changes and looks like Mike is on PTO
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
Fixes #5405.
Declarative config environment variable substitution rejected any
${VAR}reference to an unset variable that had no default, raising aConfigurationErrorand preventing SDK initialization:The declarative configuration spec requires an unset variable without a default to be replaced with an empty value (which the YAML parser then interprets as null). This matches the Java and Node.js implementations and lets configuration files be shared across languages.
Changes
opentelemetry-configuration: an unset${VAR}with no default now substitutes an empty value instead of raising.EnvSubstitutionError(its only raise site is gone) from the module and thefilepackage's public exports.${ENV:-production}still applies its default.Type of change
How Has This Been Tested?
opentelemetry-configurationtest suite (363 passed, 5 subtests).ruff checkandruff format --checkclean on the changed files.Does This PR Require a Contrib Repo Change?
Checklist: