SIGN IN SIGN UP

Substitute empty for unset config env vars without defaults (#5408)

* Substitute empty for unset config env vars without defaults

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 #5405

* opentelemetry-configuration: remove EnvSubstitutionError, guard null resource attributes

Address review feedback on #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.

* opentelemetry-configuration: deprecate EnvSubstitutionError instead of 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.

* opentelemetry-configuration: remove EnvSubstitutionError, simplify unset 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.

* Update 5408.fixed

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
D
Diego Hurtado committed
684b19d3748d3f362cbe2d06c3caad9cbde8edef
Parent: 1a71171
Committed by GitHub <noreply@github.com> on 7/22/2026, 12:40:03 PM