Skip to content

fix(v10/opentelemetry): Accept @opentelemetry/api 1.10 Attributes in wrapSamplingDecision - #25633

Closed
sentry-junior[bot] wants to merge 2 commits into
v10from
fix/v10-otel-api-1.10-ci
Closed

sentry-junior[bot] wants to merge 2 commits into
v10from
fix/v10-otel-api-1.10-ci

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

@opentelemetry/api 1.10.0 (published 2026-10-20) widened Attributes values to AnyValue. Custom samplers that follow our documented setup pass the Attributes from shouldSample to wrapSamplingDecision, and with 1.10 that no longer type-checks against spanAttributes: SpanAttributes. spanAttributes now accepts OTel Attributes. The change only widens the type, so it stays compatible with 1.9.

The same release also turned v10 CI red. A 1.10 copy of the API treats globals registered by a 1.9 copy as incompatible and falls back to no-op context and tracers. This PR fixes the test setups that hit this:

Root cause

  • *-custom-sampler E2E apps (3) fail to build with the type error above, which the SDK change fixes.
  • Vercel AI v6 node integration tests time out. ai@6 depends on @opentelemetry/api@^1.9.0, so the npm tmp install pulls 1.10.0, while the SDK registers its globals from the monorepo's 1.9.1. ai's tracer becomes a no-op, and main arrives with spans: []. ai@7 has no OTel dependency, so only v6 fails. In real installs, both copies dedupe. For the tmp installs, the runner now pins @opentelemetry/api to the SDK's version through an npm overrides entry.
  • node-otel-without-tracing pins @opentelemetry/api@1.9.0, while @sentry/node's ^1.9.1 now resolves to 1.10.0. The app registers the context manager through 1.9.0, so Sentry can't read it. A pnpm.overrides pin keeps one copy installed. generic-ts3.8 already uses the same approach.

develop is not affected. These apps and wrapSamplingDecision don't exist there anymore, so this change is v10-only.

This unblocks #25612.

via Junior system actor event.

--

View Junior Session [Sentry]

`@opentelemetry/api` 1.10.0 widened `Attributes` values to `AnyValue`, and a 1.10
copy ignores globals registered by a 1.9 copy. This broke three things on v10:

- `wrapSamplingDecision` rejected the `Attributes` a custom sampler receives in
  `shouldSample`. It now accepts OTel `Attributes`.
- Vercel AI v6 integration tests: `ai` pulled its own 1.10 copy into the tmp
  install, so its spans never reached Sentry. The runner now pins
  `@opentelemetry/api` in tmp installs to the SDK's version.
- node-otel-without-tracing pins 1.9.0 while `@sentry/node` resolved 1.10.0.
  The app now overrides `@opentelemetry/api` so only one copy is installed.

Co-Authored-By: Lukas Stracke <lukas.stracke@sentry.io>
@mydea

mydea commented Oct 21, 2026

Copy link
Copy Markdown
Member

the name of this pr should reflect what the pr does, it does not only fix CI it fixes an actual issue I believe?

@sentry-junior sentry-junior Bot changed the title fix(v10): Fix CI breakage from @opentelemetry/api 1.10.0 fix(v10/opentelemetry): Accept @opentelemetry/api 1.10 Attributes in wrapSamplingDecision Oct 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.21 kB added added
@sentry/browser - with treeshaking flags 26.66 kB added added
@sentry/browser (incl. Tracing) 47.23 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 49.03 kB added added
@sentry/browser (incl. Tracing, Profiling) 52.02 kB added added
@sentry/browser (incl. Tracing, Replay) 86.64 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.27 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 91.35 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 103.97 kB added added
@sentry/browser (incl. Feedback) 45.38 kB added added
@sentry/browser (incl. sendFeedback) 33.01 kB added added
@sentry/browser (incl. FeedbackAsync) 38.14 kB added added
@sentry/browser (incl. Metrics) 29.31 kB added added
@sentry/browser (incl. Logs) 29.55 kB added added
@sentry/browser (incl. Metrics & Logs) 30.22 kB added added
@sentry/react 30.02 kB added added
@sentry/react (incl. Tracing) 49.53 kB added added
@sentry/vue 34.1 kB added added
@sentry/vue (incl. Tracing) 49.61 kB added added
@sentry/svelte 28.24 kB added added
CDN Bundle 30.62 kB added added
CDN Bundle (incl. Tracing) 49.18 kB added added
CDN Bundle (incl. Logs, Metrics) 32.19 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 50.49 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 71.62 kB added added
CDN Bundle (incl. Tracing, Replay) 86.87 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.16 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 92.68 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.97 kB added added
CDN Bundle - uncompressed 91 kB added added
CDN Bundle (incl. Tracing) - uncompressed 148.26 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 95.71 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.24 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 221.06 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 268.08 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.05 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.78 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.74 kB added added
@sentry/nextjs (client) 52.18 kB added added
@sentry/sveltekit (client) 47.66 kB added added
@sentry/core/server 81.66 kB added added
@sentry/core/browser 67.73 kB added added
@sentry/node-core 64.04 kB added added
@sentry/node 127.22 kB added added
@sentry/node (incl. diagnostics channel injection) 171.41 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B added added
@sentry/node/light 52.09 kB added added
@sentry/node - without tracing 75.82 kB added added
@sentry/aws-serverless 84.99 kB added added
@sentry/cloudflare (withSentry) - minified 204.93 kB added added
@sentry/cloudflare (withSentry) 505.2 kB added added

dependencies: additionalDependencies,
// Packages like `ai` depend on `@opentelemetry/api` themselves. If npm resolves a newer minor than the SDK's
// copy, the newer copy refuses the globals registered by the older one and the package's spans are dropped.
overrides: additionalDependencies['@opentelemetry/api'] ? {} : { '@opentelemetry/api': getSdkOtelApiVersion() },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is weird, can we avoid this. either we bump the installed version locally (while keeping the version as ^1.9.0) or something else, if needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried the lockfile route: resolving the monorepo's @opentelemetry/api@^1.9.x to 1.10.0 (ranges unchanged) and dropping this override. It's not a drop-in on v10: 1.10 widens Attributes/AnyValue and the SDK's own build:types starts failing, e.g.

  • @sentry/opentelemetry: mapStatus.ts, parseSpanDescription.ts (Attributes → SpanAttributes), spanExporter.ts (TimedEvent[], Link[] → SpanLink[])
  • @sentry/deno / @sentry/cloudflare: opentelemetry/tracer.ts (StartSpanOptions)

So bumping locally means a type migration across several packages on v10, which feels out of scope for unblocking CI (and the OTel 2.x SDK packages still declare @opentelemetry/api <1.10.0 as peer).

Alternative that avoids the runner magic: drop the override here and instead pin '@opentelemetry/api': '~1.9.0' explicitly in the Vercel AI v6 tests' additionalDependencies, scoped to the only suites affected (ai@6 is the only additionalDependency pulling its own copy; ai@7 has none). Happy to go with either that or the full 1.10 migration — which do you prefer?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this now that we bumped the node-otel-without-tracing app to ^1.10.0?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they're independent:

  • node-otel-without-tracing is an E2E app. It has its own pnpm install with the packed tarballs, so bumping its range only affects that app.
  • This override is for the node-integration-tests. They run the SDK from the monorepo's yarn install, which is still on @opentelemetry/api@1.9.1. Only the ai@6 tmp install pulls in 1.10.0 here, and that bump doesn't change it.

Locally, span-streaming-v6 fails 6/6 without this change (the main span container has no AI spans) and passes 6/6 with it.

The open question is still mydea's, above: keep this generic pin, or replace it with an explicit '@opentelemetry/api': '~1.9.0' in the Vercel AI v6 tests' additionalDependencies. Bumping the monorepo to 1.10 instead would also break the SDK's build:types.

Comment thread dev-packages/e2e-tests/test-applications/node-otel-without-tracing/package.json Outdated
…1.10.0

Replaces the pnpm override so the app and @sentry/node resolve the same copy.
@andreiborza

Copy link
Copy Markdown
Member

Superseded by #25650

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.

2 participants