[DOCS] OpenTelemetry monitoring docs missing `OTEL_LOG_RAW_API_BODIES` configuration
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) |1to 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) |1to 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 |1to enable |
Event Name:claude_code.api_requestAttributes:model: Model used (for example, "claude-sonnet-4-6")cost_usd: Estimated cost in USDduration_ms: Request duration in millisecondsinput_tokens: Number of input tokensoutput_tokens: Number of output tokenscache_read_tokens: Number of tokens read from cachecache_creation_tokens: Number of tokens used for cache creationspeed:"fast"or"normal", indicating whether fast mode was active
Event Name:claude_code.api_errorAttributes:model: Model used (for example, "claude-sonnet-4-6")error: Error messagestatus_code: HTTP status code as a string, or"undefined"for non-HTTP errorsduration_ms: Request duration in millisecondsattempt: Total number of attempts made, including the initial request (1means 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, setOTEL_LOG_USER_PROMPTS=1Tool input arguments and parameters are not logged by default. To include them, setOTEL_LOG_TOOL_DETAILS=1. * Tool input and output content is not logged in trace spans by default. To include it, setOTEL_LOG_TOOL_CONTENT=1.
|OTEL_LOG_TOOL_CONTENT| Set to1to include tool input and output content in OpenTelemetry span events. Disabled by default to protect sensitive data. See Monitoring | |OTEL_LOG_TOOL_DETAILS| Set to1to 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 to1to 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:
- Add the variable to the configuration table on https://code.claude.com/docs/en/monitoring-usage.
- Update the API request and API error event reference to explain which log events include raw request/response bodies when this variable is enabled.
- Add security/privacy guidance covering whether bodies are redacted, truncated, or otherwise bounded, plus a warning that backends may need additional filtering.
- Add the variable to https://code.claude.com/docs/en/env-vars.
- 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 debuggingThis issue has 2 comments on GitHub. Read the full discussion on GitHub ↗