Skip to content

feat: Always stream INP and remove standalone v1 spans#22517

Open
logaretm wants to merge 9 commits into
developfrom
awad/inp-always-v2-span
Open

feat: Always stream INP and remove standalone v1 spans#22517
logaretm wants to merge 9 commits into
developfrom
awad/inp-always-v2-span

Conversation

@logaretm

@logaretm logaretm commented Jul 22, 2026

Copy link
Copy Markdown
Member

INP is now always emitted as a v2 web vital span. With span streaming enabled it rides the streaming pipeline as before. With span streaming disabled (traceLifecycle: 'static') INP overrides the static lifecycle for itself and still streams, because it reports late and would otherwise be dropped as a late child with nothing to carry it.

The bundle size increase is due to the bytes that now have to live in core without being tree-shaken which re-uses some of the stuff gen_ai uses to send out independent v2 spans. It's only a few bytes, the browser bundle savings are more significant.

Note that there is still a bunch of standalone references, those are needed to skip the span from becoming its own transaction in static lifecycles, it can be removed once we drop those in v12.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 27.96 kB +0.05% +12 B 🔺
@sentry/browser - with treeshaking flags 26.41 kB +0.06% +14 B 🔺
@sentry/browser (incl. Tracing) 46.5 kB +0.2% +89 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 47.42 kB -1.58% -759 B 🔽
@sentry/browser (incl. Tracing, Profiling) 51.26 kB +0.09% +46 B 🔺
@sentry/browser (incl. Tracing, Replay) 85.83 kB +0.16% +135 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.47 kB +0.19% +141 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 90.55 kB +0.17% +146 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 103.17 kB +0.12% +116 B 🔺
@sentry/browser (incl. Feedback) 45.13 kB +0.03% +10 B 🔺
@sentry/browser (incl. sendFeedback) 32.75 kB +0.04% +10 B 🔺
@sentry/browser (incl. FeedbackAsync) 37.81 kB +0.03% +9 B 🔺
@sentry/browser (incl. Metrics) 29.05 kB +0.05% +13 B 🔺
@sentry/browser (incl. Logs) 29.27 kB +0.05% +12 B 🔺
@sentry/browser (incl. Metrics & Logs) 29.98 kB +0.05% +14 B 🔺
@sentry/react 29.76 kB +0.04% +11 B 🔺
@sentry/react (incl. Tracing) 48.84 kB +0.27% +131 B 🔺
@sentry/vue 33.94 kB +1.66% +553 B 🔺
@sentry/vue (incl. Tracing) 48.49 kB +0.2% +92 B 🔺
@sentry/svelte 27.98 kB +0.05% +12 B 🔺
CDN Bundle 30.3 kB +0.07% +20 B 🔺
CDN Bundle (incl. Tracing) 47.68 kB -1.19% -573 B 🔽
CDN Bundle (incl. Logs, Metrics) 31.86 kB +0.03% +9 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 49.07 kB -1.03% -507 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 71.14 kB +0.03% +15 B 🔺
CDN Bundle (incl. Tracing, Replay) 85.29 kB -0.63% -539 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.59 kB -0.64% -552 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 91.05 kB -0.61% -550 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.36 kB -0.57% -528 B 🔽
CDN Bundle - uncompressed 90.17 kB +0.03% +27 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 143.13 kB -1.44% -2.09 kB 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.89 kB +0.03% +27 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.11 kB -1.4% -2.09 kB 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.65 kB +0.02% +27 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.39 kB -0.79% -2.07 kB 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.35 kB -0.78% -2.07 kB 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.09 kB -0.75% -2.07 kB 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280.05 kB -0.74% -2.07 kB 🔽
@sentry/nextjs (client) 51.38 kB +0.27% +135 B 🔺
@sentry/sveltekit (client) 46.97 kB +0.28% +129 B 🔺
@sentry/core/server 79.61 kB -0.56% -447 B 🔽
@sentry/core/browser 51.57 kB -0.85% -440 B 🔽
@sentry/node 122.92 kB -0.18% -219 B 🔽
@sentry/node (incl. diagnostics channel injection) 166.92 kB -0.14% -226 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B - -
@sentry/node - without tracing 73.2 kB -0.15% -107 B 🔽
@sentry/aws-serverless 82.69 kB -0.16% -129 B 🔽
@sentry/cloudflare (withSentry) - minified 195.96 kB -0.56% -1.09 kB 🔽
@sentry/cloudflare (withSentry) 482.45 kB -0.48% -2.29 kB 🔽

View base workflow run

@logaretm logaretm changed the title feat(browser): Always send INP as a v2 web vital span feat: Always stream INP and remove standalone v1 spans Jul 22, 2026
@logaretm
logaretm force-pushed the awad/inp-always-v2-span branch from e956bd9 to 8fb2e6d Compare July 23, 2026 13:26
@logaretm
logaretm marked this pull request as ready for review July 23, 2026 14:18
@logaretm
logaretm requested a review from a team as a code owner July 23, 2026 14:18
@logaretm
logaretm requested review from Lms24 and msonnb and removed request for a team July 23, 2026 14:18
Comment thread packages/browser-utils/src/metrics/webVitalSpans.ts Outdated
Comment thread packages/core/src/shared-exports.ts
Comment thread dev-packages/e2e-tests/test-applications/react-17/tests/transactions.test.ts Outdated
Comment thread packages/browser-utils/src/metrics/webVitalSpans.ts Outdated
@logaretm
logaretm requested review from a team as code owners July 23, 2026 20:44
@logaretm
logaretm requested review from JPeer264, chargome, isaacs and nicohrubec and removed request for a team July 23, 2026 20:44

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bd7695f. Configure here.

Comment thread packages/browser-utils/src/metrics/webVitalSpans.ts
Comment thread packages/core/src/tracing/sentrySpan.ts
Comment thread packages/core/src/tracing/idleSpan.ts
logaretm added 3 commits July 24, 2026 10:04
INP is now always emitted as a v2 web vital span. With span streaming enabled it
rides the streaming pipeline; with streaming disabled it overrides the static
trace lifecycle for itself and still streams (sent directly via `captureSpan` +
`createStreamedSpanEnvelope`, since it is a single span per interaction), because
it reports late and would otherwise be dropped.

INP was the last user of the standalone v1 span mechanism, so that is removed
entirely: the `experimental.standalone` option, the `_isStandaloneSpan` handling
and self-send path in `SentrySpan`, the `createSpanEnvelope` wire format, and the
`SpanEnvelope`/`SpanItem` types and their exports from `@sentry/core` and
`@sentry/types`.

Also dedupes the v2 `SpanContainerItem` construction shared by
`createStreamedSpanEnvelope` and gen_ai span extraction into `createSpanContainerItem`.
…e attribute

- MIGRATION.md: note the removal of `createSpanEnvelope` and the `SpanEnvelope` /
  `SpanItem` types from `@sentry/core`.
- E2E: assert `browser.web_vital.inp.value` on the INP span (the new payload field)
  in the react-17 / react-router-6 / react-router-7-spa / react-router-8-spa apps.
Under the static (transaction) trace lifecycle, force-streaming the INP
span made it an ordinary tree span, so it was also swept into the
pageload transaction (or emitted as its own transaction when parentless),
double-sending INP.

Reinstate a per-span standalone flag in core that sends the span on its
own as a v2 streamed span and excludes it from transaction assembly. INP
sets the flag when span streaming is disabled. Every piece of the
mechanism is tagged with a TODO(standalone) marker for removal once the
static trace lifecycle is dropped and every span streams on its own.
@logaretm
logaretm force-pushed the awad/inp-always-v2-span branch from 09e3cbd to 887230c Compare July 24, 2026 14:05

@Lms24 Lms24 left a comment

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.

Nice! Really glad to see v1 standalone spans being gone! I think the bundle size hit ammortizes with span streaming becoming the default anyway (i.e. captureSpan will be in all bundles by default), so this should be fine.

Also, keeping the experimental.standalone option around seems reasonable to me as long as we need to support transactions.

Comment thread dev-packages/e2e-tests/test-applications/react-17/tests/transactions.test.ts Outdated
Comment thread packages/core/src/tracing/sentrySpan.ts Outdated
Comment thread packages/core/src/tracing/sentrySpan.ts Outdated
Comment thread packages/core/src/types/startSpanOptions.ts
Comment thread packages/core/test/lib/tracing/idleSpan.test.ts
Comment thread packages/core/test/lib/tracing/trace.test.ts
The always-streamed INP migration had narrowed the INP web-vital tests to a
few spot checks. This brings back exhaustive assertions in the v2 streamed-span
shape: the full envelope header (DSC + item header) and the complete span
(attributes, is_segment, status, parent linkage, timestamps) across the browser
integration suites, and comprehensive span assertions across the react E2E apps.
logaretm added 5 commits July 24, 2026 11:24
Restore the guard that skips standalone spans in the idle span's `spanStart`
activity tracker. A standalone span is sent on its own and must not participate
in its parent's lifecycle, so it should never push activity onto or prolong an
open idle span. This can still happen with experimental interaction idle spans.

Restores the accompanying test that was dropped alongside the guard.
Drop the redundant `client` and `!_isStandaloneSpan` re-checks: emit `spanEnd`
via optional chaining, let the standalone branch own its early return with
guard-style returns, and emit `afterSpanEnd` only on the non-standalone path.
No behavior change.
Comment thread packages/core/src/tracing/sentrySpan.ts
@logaretm
logaretm requested a review from Lms24 July 24, 2026 18:20
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