From 2c541a42a59d3776490d8192854354631ea255a3 Mon Sep 17 00:00:00 2001 From: Mike Goldsmith Date: Thu, 25 Jun 2026 14:08:23 +0100 Subject: [PATCH 1/2] document OTEL_PYTHON_* bypass when OTEL_CONFIG_FILE is set --- .changelog/XXXX.added | 1 + docs/sdk/configuration.rst | 7 +++++++ .../sdk/environment_variables/__init__.py | 12 ++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 .changelog/XXXX.added diff --git a/.changelog/XXXX.added b/.changelog/XXXX.added new file mode 100644 index 0000000000..301cd8ee26 --- /dev/null +++ b/.changelog/XXXX.added @@ -0,0 +1 @@ +`opentelemetry-sdk`: document that Python-implementation extensions (`OTEL_PYTHON_*` variables) are bypassed when `OTEL_CONFIG_FILE` is set. The env-var initialisation path is skipped entirely in favour of the declarative file; honouring these alongside a config file is tracked as a follow-up. diff --git a/docs/sdk/configuration.rst b/docs/sdk/configuration.rst index 40af342e41..0d707e64d0 100644 --- a/docs/sdk/configuration.rst +++ b/docs/sdk/configuration.rst @@ -119,6 +119,13 @@ Behavior notes not consulted. Environment variables can still be read indirectly by components the file enables (for example resource detectors) and via ``${env:VAR}`` substitution. +* Python-implementation extensions (``OTEL_PYTHON_*`` variables such as + ``OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED`` or + ``OTEL_PYTHON_TRACER_CONFIGURATOR``) are **not** applied when + ``OTEL_CONFIG_FILE`` is set: the env-var initialisation path is skipped + entirely. If your app currently relies on one of these and you are + migrating to a config file, plan to capture the equivalent behaviour in + the file (or in code) instead. * Sections omitted from the file leave the corresponding global provider unset (a no-op provider), per the specification. * Setting ``disabled: true`` at the top level turns the SDK into a no-op. diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables/__init__.py index bb76fe405b..2f005a8232 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/environment_variables/__init__.py @@ -18,8 +18,16 @@ sole source for SDK construction. Spec-defined ``OTEL_*`` variables with schema equivalents are ignored. Env vars may still be read indirectly by components the file enables (e.g. resource detectors) and via -``${env:VAR}`` substitution inside the file. See the OpenTelemetry -declarative configuration specification for details. +``${env:VAR}`` substitution inside the file. + +Python-implementation extensions outside the spec (``OTEL_PYTHON_*`` +variables such as ``OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED`` or +:envvar:`OTEL_PYTHON_TRACER_CONFIGURATOR`) are also bypassed when +:envvar:`OTEL_CONFIG_FILE` is set, because the env-var initialisation path +is skipped entirely in favour of the declarative file. Honouring these +alongside a config file is tracked separately. + +See the OpenTelemetry declarative configuration specification for details. """ OTEL_RESOURCE_ATTRIBUTES = "OTEL_RESOURCE_ATTRIBUTES" From b42f4227b75dd5b2bb0a570c1566025303ec59be Mon Sep 17 00:00:00 2001 From: Mike Goldsmith Date: Thu, 25 Jun 2026 14:09:54 +0100 Subject: [PATCH 2/2] rename changelog fragment to PR #5353 --- .changelog/{XXXX.added => 5353.added} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .changelog/{XXXX.added => 5353.added} (100%) diff --git a/.changelog/XXXX.added b/.changelog/5353.added similarity index 100% rename from .changelog/XXXX.added rename to .changelog/5353.added