🐛 Bug Report: OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT is ignored, only TRACELOOP_TRACE_CONTENT disables content capture
Which component is this bug for?
All instrumentations
📜 Description
Content capture (prompts and completions) can only be turned off with the Traceloop-specific TRACELOOP_TRACE_CONTENT env var, which 24 instrumentation packages read with a default of "true" (for example openai/utils.py:202, anthropic/utils.py:32). The standard OTel GenAI variable OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT is ignored, so users following the OTel docs still send prompt and completion content, which may contain PII.
watsonx defines is_content_enabled() reading the OTel variable (watsonx/utils.py:45), but nothing calls it.
👟 Reproduction steps
export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=false- Run any instrumented LLM call (for example OpenAI chat) with a console exporter
👍 Expected behavior
No gen_ai.input.messages / gen_ai.output.messages on the span.
👎 Actual Behavior with Screenshots
Both attributes are present with the full prompt and completion. Only TRACELOOP_TRACE_CONTENT=false removes them.
🤖 Python Version
3.12
📃 Provide any additional context for the Bug.
Suggested fix: one shared helper (for example in opentelemetry-semantic-conventions-ai) that honors OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT and keeps TRACELOOP_TRACE_CONTENT as a fallback, used by every package instead of the per-package copies. The default (on vs off when neither is set) needs a decision: the OTel convention is off by default, today it is on.
Hi @doronkopit5 — I'm planning to take this on: introduce one shared helper in opentelemetry-semantic-conventions-ai that resolves content capture as
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENTwhen explicitly set,- otherwise
TRACELOOP_TRACE_CONTENT(existing defaulttrue), plus the existingoverride_enable_content_tracingcontext value,
and migrate the per-package copies to it mechanically. I'll keep the "neither variable set" default unchanged and add tests that prove the OTel variable is currently ignored and respected after the fix.
Please let me know if you'd prefer different precedence (or a different default when neither variable is set) before I open the PR.