[DOCS] OpenTelemetry monitoring docs missing `OTEL_LOG_RAW_API_BODIES` configuration

Resolved 💬 2 comments Opened Apr 16, 2026 by coygeek Closed Apr 29, 2026

Documentation Type

Missing documentation (feature not documented)

Documentation Location

https://code.claude.com/docs/en/monitoring-usage

Section/Topic

OpenTelemetry configuration, API request/API error event reference, and security/privacy guidance for emitted content

Current Documentation

The docs currently say:

| OTEL_LOG_USER_PROMPTS | Enable logging of user prompt content (default: disabled) | 1 to enable | | OTEL_LOG_TOOL_DETAILS | Enable logging of tool parameters and input arguments in tool events and trace span attributes: Bash commands, MCP server and tool names, skill names, and tool input (default: disabled) | 1 to enable | | OTEL_LOG_TOOL_CONTENT | Enable logging of tool input and output content in span events (default: disabled). Requires tracing. Content is truncated at 60 KB | 1 to enable |
Event Name: claude_code.api_request Attributes: model: Model used (for example, "claude-sonnet-4-6") cost_usd: Estimated cost in USD duration_ms: Request duration in milliseconds input_tokens: Number of input tokens output_tokens: Number of output tokens cache_read_tokens: Number of tokens read from cache cache_creation_tokens: Number of tokens used for cache creation speed: "fast" or "normal", indicating whether fast mode was active
Event Name: claude_code.api_error Attributes: model: Model used (for example, "claude-sonnet-4-6") error: Error message status_code: HTTP status code as a string, or "undefined" for non-HTTP errors duration_ms: Request duration in milliseconds attempt: Total number of attempts made, including the initial request (1 means no retries occurred) speed: "fast" or "normal", indicating whether fast mode was active
User prompt content is not collected by default. Only prompt length is recorded. To include prompt content, set OTEL_LOG_USER_PROMPTS=1 Tool input arguments and parameters are not logged by default. To include them, set OTEL_LOG_TOOL_DETAILS=1. * Tool input and output content is not logged in trace spans by default. To include it, set OTEL_LOG_TOOL_CONTENT=1.
| OTEL_LOG_TOOL_CONTENT | Set to 1 to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See Monitoring | | OTEL_LOG_TOOL_DETAILS | Set to 1 to include tool input arguments, MCP server names, and tool details in OpenTelemetry traces and logs. Disabled by default to protect PII. See Monitoring | | OTEL_LOG_USER_PROMPTS | Set to 1 to include user prompt text in OpenTelemetry traces and logs. Disabled by default (prompts are redacted). See Monitoring |

What's Wrong or Missing?

Changelog v2.1.111 added OTEL_LOG_RAW_API_BODIES to emit full API request and response bodies as OpenTelemetry log events for debugging, but the docs do not mention this environment variable anywhere in the Claude Code monitoring reference or environment variable reference.

The current monitoring docs describe only three content-related opt-in variables (OTEL_LOG_USER_PROMPTS, OTEL_LOG_TOOL_DETAILS, and OTEL_LOG_TOOL_CONTENT) and the API request/error event sections do not explain whether raw request or response bodies can be emitted, where they appear, or what privacy/safety limits apply when this mode is enabled.

That leaves users unable to discover the feature from the docs or understand how to enable it safely.

Suggested Improvement

Add OTEL_LOG_RAW_API_BODIES to the OpenTelemetry documentation in the same places that describe the other opt-in content variables.

Specifically:

  1. Add the variable to the configuration table on https://code.claude.com/docs/en/monitoring-usage.
  2. Update the API request and API error event reference to explain which log events include raw request/response bodies when this variable is enabled.
  3. Add security/privacy guidance covering whether bodies are redacted, truncated, or otherwise bounded, plus a warning that backends may need additional filtering.
  4. Add the variable to https://code.claude.com/docs/en/env-vars.
  5. If Agent SDK callers can pass this through, update https://code.claude.com/docs/en/agent-sdk/observability so the “Control sensitive data in exports” section stays aligned with the CLI monitoring docs.

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:

| Page | Line(s) | Context |
|------|---------|---------|
| https://code.claude.com/docs/en/monitoring-usage | 87-89 | OpenTelemetry configuration table lists the current content-related opt-in variables but omits OTEL_LOG_RAW_API_BODIES |
| https://code.claude.com/docs/en/monitoring-usage | 414-452 | API request and API error event sections enumerate attributes but do not describe raw request/response body emission |
| https://code.claude.com/docs/en/monitoring-usage | 606-608 | Security/privacy guidance says exported content is controlled by three opt-in variables |
| https://code.claude.com/docs/en/env-vars | 192-194 | Environment variable reference lists existing OpenTelemetry content variables but omits OTEL_LOG_RAW_API_BODIES |
| https://code.claude.com/docs/en/agent-sdk/observability | 189-197 | Agent SDK observability says only three opt-in variables add content to exported data |

Total scope: 3 pages affected

Source: Changelog v2.1.111

Exact changelog entry:

Added OTEL_LOG_RAW_API_BODIES environment variable to emit full API request and response bodies as OpenTelemetry log events for debugging

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗