🐛 Bug Report: OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT is ignored, only TRACELOOP_TRACE_CONTENT disables content capture

Open
#4,691 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@yuee3 is already working on this.

Since Nov 5, 2026.

  • #4693 by @yuee3 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Start by reading the content-capture helpers in openai/utils.py:202 and anthropic/utils.py:32, then inspect watsonx/utils.py:45 and how the instrumentation packages add message attributes to spans. Determine how a shared helper could honor the OTel variable while retaining the Traceloop variable as a fallback, and identify the default behavior that needs a decision. Done means the standard variable disables message attributes across instrumentations and tests cover both variables and the chosen default.

Written by the indexing model from the issue text.

Description

bug python
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
  1. export OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=false
  2. 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.

Dominant language
Python
Stars
7.5k
Forks
1.2k
Avg merge
2d 6h
Merged PRs (30d)
2

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from traceloop/openllmetry

All issues in traceloop/openllmetry

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.