Repository navigation
fix(server-utils): Instrument @anthropic-ai/sdk 1.x and turn off its own OTel spans - #25750
RulaKhaled wants to merge 5 commits into
Conversation
…own OTel spans Raise the orchestrion range to <2 (Completions stays <1, removed in 1.0) and set ANTHROPIC_OPEN_TELEMETRY=false unless the user set it, so 1.x's native spans don't duplicate ours where Sentry registers the global tracer provider. Fixes #25748 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
size-limit report 📦Compared: 0a20ba4 (PR test merge using develop at b364030) Against: b364030 (develop) · base run #64096 ✅ Baseline matches: this diff contains only this PR's changes.
|
With ANTHROPIC_OPEN_TELEMETRY=false the client has no tracer and injects no headers, so propagation is left to our HTTP instrumentation, which its own suites cover. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Optional E2E testsAll optional checks were successful. 57 successful. See the run. Successful checks
|
|
The tool-runner |
**Why:** Two optional E2E apps fail on `develop`, independent of any PR: - `node-anthropic-send-to-sentry (latest)` doesn't compile: `@anthropic-ai/sdk` 1.0 moved to API version `2026-10-21`, which removed `temperature` from message params. The app source is shared with the pinned 0.63.0 variant, so it drops `temperature` and the e2e no longer asserts `gen_ai.request.temperature`. Request params stay covered by `node-integration-tests`. - `node-openai-decisions-send-to-sentry` (both variants) still expected the Vercel AI origin `auto.vercelai.channel` from before #25602 renamed it to `auto.ai.vercelai`. **Depends on:** #25750. Our Anthropic instrumentation only matches SDK versions `<1`, so the latest variant compiles with this PR but still produces no gen_ai spans until #25750 raises the range. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
| }); | ||
| } | ||
| }, | ||
| { additionalDependencies: { '@anthropic-ai/sdk': '1.3.0' } }, |
There was a problem hiding this comment.
no strong feelings, but maybe it is worth it to invert it - so bump the version in node-integrationt-tests to 1.3.0, and add a test for the older version specifically?
There was a problem hiding this comment.
Done! so the main suite passed on 1.x as is apart from completions.create which 1.0 removed. that went into a new v0/ suite which also runs create, beta, streaming and the stream helper so 0.x still gets more than just completions
The main Anthropic suite now runs on @anthropic-ai/sdk 1.3.0. It passes unchanged apart from `completions.create`, which 1.0 removed. That call moves to a new `v0/` suite pinned to 0.133.0, which also runs the `messages` calls so 0.x keeps a smoke test. Bun runs neither the `v0/` nor the `v1/` suite, like the other Anthropic suites: `bun run` does not inject the diagnostics channels. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
# Conflicts: # pnpm-lock.yaml
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9e56a0e. Configure here.
The SessionToolRunner entry landed on develop after the other Anthropic ranges were raised, so it still stopped at `<1`. 1.x ships the same class at the same path, so its tool runs got no `execute_tool` spans. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Our Anthropic instrumentation was capped at
<1, so@anthropic-ai/sdk1.x wasn't instrumented. 1.x also emits its own OTel spans, and they reach Sentry wherever we register the global tracer provider (the default in Next.js, SvelteKit and Vercel Edge). Raising the range alone gave two spans per call.This raises the range to
<2and setsANTHROPIC_OPEN_TELEMETRY=falseunless the user set it, the same way we disable Next.js' own fetch spans withNEXT_OTEL_FETCH_DISABLED.Follow-up. Tool-runner
chatspans don't reach Sentry on 1.x yet.Fixes #25748
🤖 Generated with Claude Code