Skip to content

Anthropic SDK 1.x is not instrumented on Node and emits its own OTel spans #25748

Open

Description

@RulaKhaled

@anthropic-ai/sdk 1.0 shipped on Oct 21, and latest on npm is now 1.3.0. It breaks our Anthropic instrumentation in two ways.

Our Node instrumentation doesn't run on 1.x. Every entry in packages/server-utils/src/orchestrion/config/anthropic-ai.ts sets versionRange: '>=0.19.2 <1'. The patched files still exist in 1.3.0: resources/messages/messages.{js,mjs} and resources/beta/messages/messages.{js,mjs}, with Messages.create, stream and toolRunner. resources/completions.js was removed.

1.x also ships built-in OpenTelemetry tracing, and it's on by default. internal/tracing.js gets a tracer from trace.getTracerProvider() under the scope com.anthropic.sdk.typescript. Sentry registers a global tracer provider on Node, Cloudflare, Deno and Vercel Edge, so Anthropic's spans reach Sentry. As a result:

  • Node on 1.x today records Anthropic's spans in place of ours, with their attribute names and metadata_only content.
  • After the range is raised, Node will probably record two spans per call.
  • Cloudflare, Deno and Edge use the client wrapper, which has no version check, so they probably record two spans already.

None of this has been reproduced yet. It comes from reading the 1.3.0 source and our code.

Decision: we keep our spans and suppress theirs while Anthropic_AI is installed. Our spans follow our conventions and AI Insights expects them. A user who removes Anthropic_AI from their integrations gets Anthropic's spans back.

Scope:

  • Raise the orchestrion range to <2, except for Completions.
  • Return a no-op tracer for com.anthropic.sdk.typescript from our tracer providers when Anthropic_AI is active.
  • Test on 1.x for Node and Cloudflare. Cover one span per call, streaming, trace propagation, and that removing the integration brings Anthropic's spans back.

Activity

  1. linear-code commented on Oct 26, 2026

    @linear-code
  2. self-assigned this
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions