[BUG] VS Code Extension: OTEL_LOG_USER_PROMPTS=1 does not log prompt content (works in CLI)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
[BUG] VS Code Extension: OTEL_LOG_USER_PROMPTS=1 does not log prompt content (works in CLI)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using the Claude Code VS Code extension with OpenTelemetry configured and OTEL_LOG_USER_PROMPTS=1 set, user prompt content is not included in claude_code.user_prompt log events. Only prompt_length is recorded (the default redacted behavior).
The same configuration works correctly when running Claude Code via the CLI — prompt content is included in the exported events as expected.
Important: This is not an environment variable propagation issue. Other OTEL functionality works correctly in the VS Code extension — metrics, claude_code.tool_result events, and claude_code.api_call events are all exported successfully. The issue is specifically that OTEL_LOG_USER_PROMPTS=1 is not being respected for prompt content logging.
Expected Behavior
claude_code.user_prompt events should include the prompt attribute containing the full prompt text when OTEL_LOG_USER_PROMPTS=1 is set, consistent with CLI behavior.
Actual Behavior
claude_code.user_prompt events are emitted but the prompt attribute is either missing or redacted. Only prompt_length is present. All other OTEL telemetry (metrics, tool results, API calls) exports correctly.
Environment
- Platform: Anthropic API
- Claude Code version: 2.1.39
- VS Code version: (running in devcontainer — check Help > About in VS Code)
- Operating System: Linux 6.6.87.2-microsoft-standard-WSL2 (devcontainer on Windows WSL2)
- OTEL backend: SigNoz
Configuration
Environment variables set via devcontainer remoteEnv (confirmed working for all other OTEL functionality). (This is not the complete set of environment variables I have configured; only the most relevant.)
{
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_LOG_USER_PROMPTS": "1",
}
Additional Context
- Other telemetry data (metrics, tool results, API calls) exports correctly from the VS Code extension, confirming that environment variables are being passed through successfully.
- The devcontainer uses the
anthropic.claude-codeVS Code extension. - This may be related to #10972 (VS Code extension omitting certain telemetry attributes that the CLI includes), suggesting the extension's telemetry instrumentation has divergent code paths from the CLI.
What Should Happen?
claude_code.user_prompt events should include the prompt attribute containing the full prompt text when OTEL_LOG_USER_PROMPTS=1 is set, consistent with CLI behavior.
Error Messages/Logs
Steps to Reproduce
Environment variables set via devcontainer remoteEnv (confirmed working for all other OTEL functionality). (This is not the complete set of environment variables I have configured; only the most relevant.)
{
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_LOG_USER_PROMPTS": "1",
}
Claude Model
Not sure / Multiple models
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.39
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗