From b776db312536c8367d03ea07003909d6350b3da6 Mon Sep 17 00:00:00 2001 From: krrishapatel Date: Sat, 1 Aug 2026 22:56:58 -0700 Subject: [PATCH 1/2] opentelemetry-instrumentation-logging: fix documented name of code attributes env var The envvar directive in constants.py documented this option as OTEL_PYTHON_CODE_ATTRIBUTES, but the instrumentation reads OTEL_PYTHON_LOG_CODE_ATTRIBUTES, so following the published docs had no effect. The surrounding prose in the same module, environment_variables.py, and the test suite all use the LOG_ form. Written with assistance from Claude Opus 5 (Anthropic), which located the mismatch, verified it against the installed package, and drafted this change. --- .../src/opentelemetry/instrumentation/logging/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/constants.py b/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/constants.py index f787184cad..58b338b8c3 100644 --- a/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/constants.py +++ b/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/constants.py @@ -56,7 +56,7 @@ The default value is ``true``. -.. envvar:: OTEL_PYTHON_CODE_ATTRIBUTES +.. envvar:: OTEL_PYTHON_LOG_CODE_ATTRIBUTES Set this env var to ``true`` to add ``code`` attributes (``code.file.path``, ``code.function.name``, ``code.line.number``) to OpenTelemetry logs, referencing the Python source location that emitted each log message. From 47bfd451f6dbdd09457b0a5f5cba763e5637dfda Mon Sep 17 00:00:00 2001 From: krrishapatel Date: Sat, 1 Aug 2026 22:57:25 -0700 Subject: [PATCH 2/2] Add changelog entry for #4912 --- .changelog/4912.fixed | 1 + 1 file changed, 1 insertion(+) create mode 100644 .changelog/4912.fixed diff --git a/.changelog/4912.fixed b/.changelog/4912.fixed new file mode 100644 index 0000000000..e326be2d6a --- /dev/null +++ b/.changelog/4912.fixed @@ -0,0 +1 @@ +`opentelemetry-instrumentation-logging`: fix documented name of the code attributes env var to `OTEL_PYTHON_LOG_CODE_ATTRIBUTES`