From 367e5e08aba69d228f5c12f716828dc1bdea8964 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Fri, 27 Feb 2026 10:01:33 +0100 Subject: [PATCH] instrumentation-genai: stop setting OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true (#4263) The openai-v2 examples predate (2024) the Jan 2025 decouple (f3b9e6ec96b7cc3717d5c8b529da7a8923810973 in core) of the log machinery setup from the LoggingHandler setup. So unless I'm missing something and you really want to see OpenTelemetry logs shipped from Python logging module usage in these genai examples I think we can drop these. We're moving the logging handler from the sdk to the opentelemetry-instrumentation-logging and deprecating that environment variable. --- .../examples/zero-code/.env | 3 --- .../examples/zero-code/README.rst | 2 -- .../examples/zero-code/.env.example | 3 --- .../examples/embeddings/.env | 3 --- .../examples/embeddings/README.rst | 3 +-- .../examples/zero-code/.env | 3 --- .../examples/zero-code/README.rst | 1 - .../examples/zero-code/.env | 5 +---- 8 files changed, 2 insertions(+), 21 deletions(-) diff --git a/instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code/.env b/instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code/.env index 1d5ae9c66..20dbd56a3 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code/.env +++ b/instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code/.env @@ -7,9 +7,6 @@ ANTHROPIC_API_KEY=sk-ant-YOUR_API_KEY OTEL_SERVICE_NAME=opentelemetry-python-claude-agent-sdk -# Change to 'false' to disable collection of python logging logs -OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true - # Uncomment if your OTLP endpoint doesn't support logs # OTEL_LOGS_EXPORTER=console diff --git a/instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code/README.rst b/instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code/README.rst index ee2f0056c..4ac2fb38f 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code/README.rst @@ -15,8 +15,6 @@ interaction. Note: `.env <.env>`_ file configures additional environment variables: -- ``OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`` configures - OpenTelemetry SDK to export logs and events. - ``OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`` configures Claude Agent SDK instrumentation to capture prompt and completion contents on events. diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/examples/zero-code/.env.example b/instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/examples/zero-code/.env.example index 8f3966850..9e2aeb302 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/examples/zero-code/.env.example +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/examples/zero-code/.env.example @@ -7,8 +7,5 @@ OPENAI_API_KEY=sk-YOUR_API_KEY OTEL_SERVICE_NAME=opentelemetry-python-openai-agents-zero-code -# Enable auto-instrumentation for logs if desired -OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true - # Optionally override the agent name reported on spans # OTEL_GENAI_AGENT_NAME=Travel Concierge diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/.env b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/.env index 8f2dd62b9..ab64ccd5f 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/.env +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/.env @@ -12,9 +12,6 @@ OPENAI_API_KEY=sk-YOUR_API_KEY OTEL_SERVICE_NAME=opentelemetry-python-openai -# Change to 'false' to disable collection of python logging logs -OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true - # Uncomment if your OTLP endpoint doesn't support logs # OTEL_LOGS_EXPORTER=console diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/README.rst b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/README.rst index 66a7c58a7..d31a5c567 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/README.rst @@ -11,7 +11,6 @@ Metrics capture token usage and performance data. Note: ``.env`` file configures additional environment variables: -- ``OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`` configures OpenTelemetry SDK to export logs and events. - ``OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`` configures OpenAI instrumentation to capture content on events. - ``OTEL_LOGS_EXPORTER=otlp`` to specify exporter type. @@ -41,4 +40,4 @@ Run the example like this: dotenv run -- opentelemetry-instrument python main.py You should see embedding information printed while traces and metrics export to your -configured observability tool. \ No newline at end of file +configured observability tool. diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/.env b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/.env index 8f2dd62b9..ab64ccd5f 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/.env +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/.env @@ -12,9 +12,6 @@ OPENAI_API_KEY=sk-YOUR_API_KEY OTEL_SERVICE_NAME=opentelemetry-python-openai -# Change to 'false' to disable collection of python logging logs -OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true - # Uncomment if your OTLP endpoint doesn't support logs # OTEL_LOGS_EXPORTER=console diff --git a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/README.rst b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/README.rst index 4332c0b7c..1498fc75d 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/README.rst +++ b/instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/README.rst @@ -12,7 +12,6 @@ your OpenAI requests. Note: `.env <.env>`_ file configures additional environment variables: -- ``OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`` configures OpenTelemetry SDK to export logs and events. - ``OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`` configures OpenAI instrumentation to capture prompt and completion contents on events. - ``OTEL_LOGS_EXPORTER=otlp`` to specify exporter type. diff --git a/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/zero-code/.env b/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/zero-code/.env index f224ac248..7ced5640c 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/zero-code/.env +++ b/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/zero-code/.env @@ -4,9 +4,6 @@ OTEL_SERVICE_NAME=opentelemetry-python-vertexai -# Change to 'false' to disable collection of python logging logs -OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true - # Uncomment if your OTLP endpoint doesn't support logs # OTEL_LOGS_EXPORTER=console @@ -25,4 +22,4 @@ OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_AND_EVENT OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK = "upload" # Required if using a completion hook. The path to upload content to for example gs://my_bucket. -OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH = "gs://my_bucket" \ No newline at end of file +OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH = "gs://my_bucket"