Skip to content

Commit 367e5e0

Browse files
authored
instrumentation-genai: stop setting OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true (#4263)
The openai-v2 examples predate (2024) the Jan 2025 decouple (f3b9e6e 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.
1 parent 7e49db4 commit 367e5e0

File tree

8 files changed

+2
-21
lines changed
  • instrumentation-genai
    • opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code
    • opentelemetry-instrumentation-openai-agents-v2/examples/zero-code
    • opentelemetry-instrumentation-openai-v2/examples
    • opentelemetry-instrumentation-vertexai/examples/zero-code

8 files changed

+2
-21
lines changed

instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code/.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ ANTHROPIC_API_KEY=sk-ant-YOUR_API_KEY
77

88
OTEL_SERVICE_NAME=opentelemetry-python-claude-agent-sdk
99

10-
# Change to 'false' to disable collection of python logging logs
11-
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
12-
1310
# Uncomment if your OTLP endpoint doesn't support logs
1411
# OTEL_LOGS_EXPORTER=console
1512

instrumentation-genai/opentelemetry-instrumentation-claude-agent-sdk/examples/zero-code/README.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ interaction.
1515

1616
Note: `.env <.env>`_ file configures additional environment variables:
1717

18-
- ``OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`` configures
19-
OpenTelemetry SDK to export logs and events.
2018
- ``OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`` configures
2119
Claude Agent SDK instrumentation to capture prompt and completion contents
2220
on events.

instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/examples/zero-code/.env.example

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,5 @@ OPENAI_API_KEY=sk-YOUR_API_KEY
77

88
OTEL_SERVICE_NAME=opentelemetry-python-openai-agents-zero-code
99

10-
# Enable auto-instrumentation for logs if desired
11-
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
12-
1310
# Optionally override the agent name reported on spans
1411
# OTEL_GENAI_AGENT_NAME=Travel Concierge

instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ OPENAI_API_KEY=sk-YOUR_API_KEY
1212

1313
OTEL_SERVICE_NAME=opentelemetry-python-openai
1414

15-
# Change to 'false' to disable collection of python logging logs
16-
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
17-
1815
# Uncomment if your OTLP endpoint doesn't support logs
1916
# OTEL_LOGS_EXPORTER=console
2017

instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/embeddings/README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Metrics capture token usage and performance data.
1111

1212
Note: ``.env`` file configures additional environment variables:
1313

14-
- ``OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`` configures OpenTelemetry SDK to export logs and events.
1514
- ``OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`` configures OpenAI instrumentation to capture content on events.
1615
- ``OTEL_LOGS_EXPORTER=otlp`` to specify exporter type.
1716

@@ -41,4 +40,4 @@ Run the example like this:
4140
dotenv run -- opentelemetry-instrument python main.py
4241

4342
You should see embedding information printed while traces and metrics export to your
44-
configured observability tool.
43+
configured observability tool.

instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/.env

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ OPENAI_API_KEY=sk-YOUR_API_KEY
1212

1313
OTEL_SERVICE_NAME=opentelemetry-python-openai
1414

15-
# Change to 'false' to disable collection of python logging logs
16-
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
17-
1815
# Uncomment if your OTLP endpoint doesn't support logs
1916
# OTEL_LOGS_EXPORTER=console
2017

instrumentation-genai/opentelemetry-instrumentation-openai-v2/examples/zero-code/README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ your OpenAI requests.
1212

1313
Note: `.env <.env>`_ file configures additional environment variables:
1414

15-
- ``OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true`` configures OpenTelemetry SDK to export logs and events.
1615
- ``OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`` configures OpenAI instrumentation to capture prompt and completion contents on events.
1716
- ``OTEL_LOGS_EXPORTER=otlp`` to specify exporter type.
1817

instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/zero-code/.env

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
OTEL_SERVICE_NAME=opentelemetry-python-vertexai
66

7-
# Change to 'false' to disable collection of python logging logs
8-
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
9-
107
# Uncomment if your OTLP endpoint doesn't support logs
118
# OTEL_LOGS_EXPORTER=console
129

@@ -25,4 +22,4 @@ OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_AND_EVENT
2522
OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK = "upload"
2623

2724
# Required if using a completion hook. The path to upload content to for example gs://my_bucket.
28-
OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH = "gs://my_bucket"
25+
OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH = "gs://my_bucket"

0 commit comments

Comments
 (0)