OpenTelemetry: bridged / remote-controlled sessions emit no local OTel metrics

Status Open
Reported on v2.1.214
Maintainer reply None cached
Activity 0 comments · opened Jul 18, 2026

Environment

  • Claude Code 2.1.214, Windows 11.
  • Telemetry enabled via ~/.claude/settings.json env: CLAUDE_CODE_ENABLE_TELEMETRY=1, OTEL_METRICS_EXPORTER=otlp, OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf, OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318, OTEL_METRIC_EXPORT_INTERVAL=10000, OTEL_RESOURCE_ATTRIBUTES=service.name=claude-code-host.
  • OTLP → local OpenTelemetry Collector → Prometheus/Grafana.

What happens

A normal interactive claude session emits the full metric suite and it arrives at my collector:
claude_code_token_usage_tokens_total, claude_code_cost_usage_USD_total, claude_code_active_time_seconds_total, claude_code_session_count_total.

But a session started via the remote-control bridge (its environment contains CLAUDE_CODE_BRIDGE_SESSION_ID; e.g. a background / remote-controlled agent) emits zero local OTel metrics — not even session_count — despite 3h of heavy token usage.

Evidence

Two concurrent host sessions, identical service.name=claude-code-host:

  • Normal interactive session session_id=c879b819… → full metrics (~243k tokens, cost, active_time). Flushed on the export interval / on /exit.
  • Bridged session session_id=7e9835e6… (has CLAUDE_CODE_BRIDGE_SESSION_ID) → nothing emitted over its whole lifetime.

Verified via Prometheus /api/v1/series?match[]={session_id="…"} — the bridged session's id returns no series at all.

Impact

Users who enable OpenTelemetry to track all of their Claude Code usage get silently incomplete data. Remote-controlled / background-agent sessions can consume large amounts of tokens, yet they are invisible to the user's own collector — so per-host token totals and cost are understated with no indication anything is missing.

Expected

Bridged / remote-controlled sessions should emit local OTel telemetry the same way normal sessions do. If this is intentional (usage metered server-side only), please document it explicitly in the OpenTelemetry monitoring docs.

View original on GitHub ↗