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.
This commit is contained in:
Riccardo Magliocchetti
2026-02-27 10:01:33 +01:00
committed by GitHub
parent 7e49db45ab
commit 367e5e08ab
8 changed files with 2 additions and 21 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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.
configured observability tool.

View File

@@ -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

View File

@@ -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.

View File

@@ -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"
OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH = "gs://my_bucket"