Skip to content

fix(anthropic): report dropped stream telemetry without logging content - #327

Merged
nik13 merged 3 commits into
devfrom
fix/anthropic-telemetry-diagnostics
Oct 31, 2026
Merged

nik13 merged 3 commits into
devfrom
fix/anthropic-telemetry-diagnostics

Conversation

@nik13

@nik13 nik13 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Two follow-ups from today's second release.

1. Anthropic: report dropped stream telemetry (the P2 from #310's independent review). When a stream event can't be read or recorded, the native stream is unchanged and the span still exports, but without that event's content or usage. Until now that happened silently. The first drop on a stream now logs a WARNING naming the exception type, never the message, which can carry model content. Later drops on the same stream log at DEBUG, and giving up on stalled earlier events is reported too. Drops are recorded under a dedicated lock and logged only after the stream's lifecycle lock is released. A log handler therefore can't block a concurrent close(), a raising handler can't replace the native stream item, and the once-per-stream WARNING claim is atomic. tests/test_r9_drop_diagnostics.py covers each of these, including the independent reviewer's reproducers; five of its eight tests fail on the first version of this change. The package suite passes against anthropic 2.3.0 and the published core 1.2.2 (91 passed, 2 skipped, sandboxed with outbound network denied).

This commit's body also carries #310's user-facing changes as nested conventional messages. #310 merged dev into its branch in a commit titled fix(anthropic): … (d26eb14). Because a merge commit's file list is its diff against the first parent, release-please attributed that fix to all ~120 components and proposed bumping every package. #310 and #315 now carry commit-override blocks (see their PR bodies) that turn those commits into chore, so traceAI-anthropic's 0.1.12 release notes come from this commit instead.

2. Release config: core no longer releases for test, e2e or example changes. The core component watches python/ minus frameworks and traceai, so the CrewAI fix's shared test under python/tests proposed fi-instrumentation-otel 1.2.3 with no code change. Those directories don't ship in the core package. release_plan.py --check, bootstrap_audit.py --check, the 51 release tests and the offline release-please strategy test pass.

With both in place, a release-please dry run against main proposes only the intended releases: traceAI-crewai 0.1.10, eight npm 0.1.1 ESM fixes and, after this merges, traceAI-anthropic 0.1.12.

🤖 Generated with Claude Code

nik13 and others added 3 commits October 31, 2026 03:43
… changes

The core component watches python/ minus frameworks and traceai, so a framework
fix that adds a shared test under python/tests proposed a core release with no
code change (fi-instrumentation-otel 1.2.3 for the CrewAI fix). Tests, e2e tests
and examples do not ship in the core package; exclude them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a stream event cannot be read or recorded, the native stream is unchanged
and the span is still exported, but without that event's content or usage. The
first drop on a stream now logs a WARNING that names the exception type (never
its message, which can carry model content); later drops on the same stream log
at DEBUG. Giving up on stalled earlier events is reported the same way.

fix(anthropic): keep Messages tracing working on SDKs without the legacy Completions API

fix(anthropic): preserve native stream iteration, partial close, context-manager results, errors and cancellation

fix(anthropic): finalize stream telemetry once, outside the stream lock, with a bounded queue of pending events

fix(anthropic): restore token-count hooks and accept mapping-shaped tool inputs

fix(anthropic): require fi-instrumentation-otel>=1.2.2 for its error-detail policy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record drop decisions under a dedicated lock and emit them only after the
lifecycle lock is released, so an application log handler can neither block a
concurrent close nor replace the native stream item by raising. The
once-per-stream WARNING claim is now atomic between extraction threads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nik13
nik13 merged commit 8600a66 into dev Oct 31, 2026
22 of 31 checks passed
@nik13
nik13 deleted the fix/anthropic-telemetry-diagnostics branch October 31, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant