[BUG] OpenTelemetry not working when Claude Code runs in VS Code extension (pipe/stream-json mode)

Resolved 💬 2 comments Opened Mar 16, 2026 by bellowswang Closed Apr 14, 2026

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?

Terminal claude code would export OTEL data without any problem.
VS Code Panel/Sidebar claude code wouldn't be able to export any OTEL data.
~/.claude/settings.json and claudeCode.environmentVariables are correctly configured.
It might not only be about vs code. It's a general issue in the pipe/stream-json mode.

What Should Happen?

Even if it's in the pipe/stream-json mode, it should export OTEL data based on the configurations in settings.json

Error Messages/Logs

Steps to Reproduce

Configure OpenTelemetry in ~/.claude/settings.json:

{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://localhost:4317"
}
}
Also configure in VS Code settings.json:

{
"claudeCode.environmentVariables": [
{ "name": "CLAUDE_CODE_ENABLE_TELEMETRY", "value": "1" },
{ "name": "OTEL_METRICS_EXPORTER", "value": "otlp" },
{ "name": "OTEL_LOGS_EXPORTER", "value": "otlp" },
{ "name": "OTEL_EXPORTER_OTLP_PROTOCOL", "value": "grpc" },
{ "name": "OTEL_EXPORTER_OTLP_ENDPOINT", "value": "http://localhost:4317" }
]
}
Start an OTEL collector listening on localhost:4317 (e.g. via otel-desktop-viewer, Jaeger, or any OTLP-compatible collector)

Open a terminal and run claude, send a message — OTEL data is received by the collector ✅

Open VS Code, use Claude Code in the panel/sidebar, send a message — No OTEL data received ❌

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.76

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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