OTel logs stop exporting for specific mature/resumed Claude Code sessions while metrics continue

Status Open
Reported on v2.1.241
Maintainer reply None cached
Activity 2 comments · opened Aug 25, 2026

What's Wrong?

For some mature/resumed Claude Code sessions, OpenTelemetry log events stop exporting while OpenTelemetry metrics from the exact same session continue normally.

I reproduced this outside VS Code using standalone Claude CLI.

The key comparison is:

  • New session: logs work, metrics work
  • Small/new session after claude --resume: logs work, metrics work
  • Specific mature session after claude --resume: metrics continue, but no log events arrive

For the failing mature session, Claude Code debug output confirms:

  • telemetry is enabled
  • the OTLP log exporter initializes successfully
  • the event logger is set successfully
  • First logs export: SUCCESS
  • First metrics export: SUCCESS
  • claude_code.api_request is actually created locally for the model turn

However, no log events from that session reach the OTLP backend.

This appears to be specific to certain mature session state rather than a general --resume, Collector, transport, VS Code, or backend failure.

What Should Happen?

A resumed Claude Code session should continue exporting OpenTelemetry log events normally.

If Claude creates a claude_code.api_request event locally, that event should be passed to the configured OTLP log pipeline and exported successfully, just as it is for a new session or a small session after claude --resume.

Expected behavior:

  • claude_code.api_request continues exporting
  • OTel metrics continue exporting
  • resuming a session does not change telemetry behavior
  • long-lived/mature conversations do not silently lose discrete log events while metrics remain healthy

Error Messages / Logs

Healthy and failing sessions both initialize telemetry successfully:

[DEBUG] [3P telemetry] getOtlpReaders: types=["otlp"], interval=5000, protocol=http/protobuf
[DEBUG] [3P telemetry] getOtlpLogExporters: types=["console","otlp"], protocol=http/protobuf
[DEBUG] [3P telemetry] Created 2 log exporter(s)
[DEBUG] [3P telemetry] Event logger set successfully
[DEBUG] [3P telemetry] First logs export: SUCCESS
[DEBUG] [3P telemetry] First metrics export: SUCCESS

For the failing mature session, after a normal model turn Claude's debug log also contains:

body: 'claude_code.api_request'
'event.name': 'api_request'

Despite that:

  • OTel metrics from the same session continue arriving downstream
  • zero api_request log events arrive
  • zero log events of any event name arrive for that session during the same test window

This reproduces with standalone claude --resume and VS Code completely closed.

Steps to Reproduce

  1. Configure Claude Code OTel so both logs and metrics use HTTP/protobuf.
  2. Start a brand-new Claude CLI session.
  3. Send a normal prompt.
  4. Verify downstream that both signals arrive:
  • claude_code.api_request / api_request log events
  • metrics such as claude_code.token.usage, claude_code.cost.usage, and claude_code.active_time.total
  1. Exit Claude completely.
  2. Resume that same small session:

``
claude --resume <small-session-id>
``

  1. Send another normal prompt.
  2. Verify both logs and metrics still arrive.

This confirms that --resume by itself does not reproduce the failure.

  1. Exit Claude again.
  2. Resume an older/mature Claude conversation using the same OTel configuration:

``
claude --resume <mature-session-id>
``

  1. Verify from Claude debug output that:
  • log exporter initializes with protocol=http/protobuf
  • metrics exporter initializes with protocol=http/protobuf
  • Event logger is set successfully
  • First logs export reports SUCCESS
  • First metrics export reports SUCCESS
  1. Send a normal prompt in the mature resumed session.
  2. Observe Claude's debug log for the model turn.

It contains:
``
body: 'claude_code.api_request'
'event.name': 'api_request'
``

  1. Check the OTLP backend for that exact session.

Actual result:

  • metrics continue arriving
  • no api_request log event arrives
  • no log event of any event name arrives
  1. Repeat with the small resumed session under the same machine, Collector, and OTel configuration.

The small session continues exporting both logs and metrics successfully.

Claude Model

Sonnet 5

Is this a regression?

Unknown / Not sure.

I have not established a specific previous Claude Code version where this exact mature-session scenario worked reliably.

Last Working Version

Unknown

Claude Code Version

2.1.241

API Platform

Anthropic API

Operating System

Windows

Terminal / Shell

PowerShell

Additional Information

The issue reproduces in standalone Claude CLI with VS Code completely closed.

Controlled comparison on the same machine, against the same OTLP Collector and with the same OTel configuration:

Small resumed session:

LOGS     ✓
METRICS  ✓

Mature resumed session:

LOGS     ✗
METRICS  ✓

The failing mature session still creates claude_code.api_request locally according to Claude's own debug output.

The Event logger initializes successfully and initial log export reports SUCCESS, but subsequent model-turn log records do not arrive downstream.

Metrics from the exact same session continue arriving normally.

This makes a global Collector, backend, network, authentication, VS Code, or simple --resume failure unlikely.

The apparent failure boundary is:

Claude model turn
    ↓
claude_code.api_request created locally ✓
    ↓
Event logger / OTLP log exporter initialized ✓
    ↓
actual log record reaches OTLP backend ✗

Meanwhile:

Claude model turn
    ↓
OTel metrics
    ↓
metrics reach backend ✓

Raw debug logs contain local paths, repository information, and other environment details, so I have not attached them publicly. I can provide a sanitized telemetry-only debug extract if needed.

View original on GitHub ↗

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