Skip to content

[experiment] ref!: Remove transactions and the static trace lifecycle - #23240

Draft
Lms24 wants to merge 2 commits into
developfrom
ref/remove-transactions
Draft

[experiment] ref!: Remove transactions and the static trace lifecycle#23240
Lms24 wants to merge 2 commits into
developfrom
ref/remove-transactions

Conversation

@Lms24

@Lms24 Lms24 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Experiment — not for merge. Opened to get size-limit numbers for removing transactions in v12.

Span streaming becomes the only trace lifecycle: no transaction events, no static lifecycle, no standalone spans. Every code path that only existed to build, filter or ship transactions is deleted, including legacy browser profiling (it attached profiles to transaction envelope items) and the transaction branches of event processors in core, vercel-ai, Next.js and SvelteKit.

A second commit removes what that left behind — code that was reachable but dead. The notable one: setMeasurement() was a silent no-op, since the only reader of its timed events was the transaction measurements field. That's gone along with TimedEvent, the write-only profile_id/exclusive_time/measurements/segment_id fields on SpanJSON, and the capturedSpanScope scope-rerouting in captureEvent.

Three options had no streaming equivalent and are dropped rather than reimplemented, since processSpan/processSegmentSpan cannot drop a span: httpIntegration's dropSpansForIncomingRequestStatusCodes, and the low-quality-transaction filters in Nuxt and SolidStart. Tests are intentionally not updated.

Span streaming is now the only trace lifecycle. The SDK no longer sends
transaction events, so every code path that only existed to build, scrub,
filter or ship them is gone.

Removed from core: the `traceLifecycle` option, `_convertSpanToTransaction`,
the segment-span capture strategy and its deferred-capture queue, standalone
spans, `beforeSendTransaction`, `ignoreTransactions`, `withStaticSpan` /
`withStreamedSpan`, gen_ai span extraction, the v1<->v2 span converters,
`hasSpanStreamingEnabled`, the `TransactionEvent` type and the `spans`,
`measurements` and `transaction_info` fields on `Event`.

Also removed the downstream hooks that no longer see any traffic: the
transaction branches of `eventFilters`, `prepareEvent` span normalization,
`scopeData` transaction naming, the vercel-ai transaction processor and its
token-accumulation utils, and the legacy `preprocessEvent` paths in Next.js
and SvelteKit (both already had `processSpan` counterparts). Legacy browser
profiling goes too: it attached profiles to transaction envelope items and
was therefore unreachable. UI Profiling (v2) is untouched. Web vitals
simplify as well, since CLS/LCP/INP now always stream as their own spans.

Three options had no streaming equivalent and are dropped rather than
reimplemented, because `processSpan`/`processSegmentSpan` cannot drop a span:
`httpIntegration`'s `dropSpansForIncomingRequestStatusCodes`, and the
low-quality-transaction filters in Nuxt and SolidStart. Shipping this needs
either a droppable streaming hook or `ignoreSpans`-based replacements.

Tests are intentionally not updated; this branch measures bundle size impact.

BREAKING CHANGE: The SDK no longer sends transaction events. `traceLifecycle`,
`beforeSendTransaction`, `ignoreTransactions`, `withStaticSpan`,
`withStreamedSpan`, `dropSpansForIncomingRequestStatusCodes` and legacy
browser profiling (`profilesSampleRate`) are removed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@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 1 potential issue.

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 cf88354. Configure here.


const traceData = event.contexts.trace.data;

// Get the route from trace data

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Next.js URL backfill never runs

High Severity

setUrlProcessingMetadata now runs on afterSegmentSpanEnd against the live span, but http.server and many route attributes are only applied later in processSegmentSpan on the streamed span JSON. On the Node server path the live span never gets sentry.op, so the op !== 'http.server' guard always returns early and request URL backfill never happens. Route values only set during enhancement, such as from sentry.route_backfill, are also invisible here.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cf88354. Configure here.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.89 kB -4.81% -1.46 kB 🔽
@sentry/browser - with treeshaking flags 27.25 kB -4.47% -1.27 kB 🔽
@sentry/browser - with treeshaking flags tracing without tracing 25.14 kB -6.39% -1.71 kB 🔽
@sentry/browser (incl. Tracing) 45.73 kB -5.93% -2.88 kB 🔽
@sentry/browser (incl. Tracing + Span Streaming) 45.73 kB -5.94% -2.89 kB 🔽
@sentry/browser (incl. Tracing, Profiling) 48.63 kB -9.05% -4.84 kB 🔽
@sentry/browser (incl. Tracing, Replay) 85.14 kB -3.31% -2.91 kB 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.75 kB -3.49% -2.7 kB 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 89.86 kB -3.14% -2.9 kB 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 102.51 kB -2.79% -2.94 kB 🔽
@sentry/browser (incl. Feedback) 46.17 kB -3.18% -1.51 kB 🔽
@sentry/browser (incl. sendFeedback) 33.72 kB -4.16% -1.46 kB 🔽
@sentry/browser (incl. FeedbackAsync) 38.83 kB -3.74% -1.5 kB 🔽
@sentry/browser (incl. Metrics) 29.96 kB -4.67% -1.47 kB 🔽
@sentry/browser (incl. Logs) 30.17 kB -4.68% -1.48 kB 🔽
@sentry/browser (incl. Metrics & Logs) 30.88 kB -4.53% -1.46 kB 🔽
@sentry/react 30.63 kB -4.72% -1.52 kB 🔽
@sentry/react (incl. Tracing) 47.95 kB -5.65% -2.87 kB 🔽
@sentry/vue 33.23 kB -6.26% -2.22 kB 🔽
@sentry/vue (incl. Tracing) 47.69 kB -5.73% -2.9 kB 🔽
@sentry/svelte 28.92 kB -4.81% -1.46 kB 🔽
CDN Bundle 30.21 kB -4.43% -1.4 kB 🔽
CDN Bundle (incl. Tracing) 46.25 kB -5.46% -2.67 kB 🔽
CDN Bundle (incl. Logs, Metrics) 32.47 kB -4.06% -1.37 kB 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 48.26 kB -5.16% -2.63 kB 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 72.88 kB -2.02% -1.5 kB 🔽
CDN Bundle (incl. Tracing, Replay) 83.66 kB -3.29% -2.84 kB 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 85.63 kB -3.14% -2.77 kB 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 89.44 kB -3.01% -2.77 kB 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 91.4 kB -2.96% -2.79 kB 🔽
CDN Bundle - uncompressed 89.42 kB -4.82% -4.53 kB 🔽
CDN Bundle (incl. Tracing) - uncompressed 138.22 kB -5.93% -8.71 kB 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 95.89 kB -4.51% -4.53 kB 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 144.07 kB -5.7% -8.71 kB 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 224.61 kB -2.07% -4.73 kB 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 257.26 kB -3.35% -8.91 kB 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 263.1 kB -3.28% -8.91 kB 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 270.95 kB -3.19% -8.91 kB 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 276.79 kB -3.13% -8.91 kB 🔽
@sentry/nextjs (client) 50.55 kB -5.29% -2.82 kB 🔽
@sentry/sveltekit (client) 46.16 kB -5.85% -2.87 kB 🔽
@sentry/core/server 63.05 kB -3.96% -2.6 kB 🔽
@sentry/core/browser 49.37 kB -5.03% -2.61 kB 🔽
@sentry/node 115.3 kB -2.68% -3.16 kB 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 78.22 kB -5.27% -4.35 kB 🔽
@sentry/aws-serverless 88.66 kB -3.57% -3.28 kB 🔽
@sentry/cloudflare (withSentry) - minified 204.59 kB -4.71% -10.1 kB 🔽
@sentry/cloudflare (withSentry) 506.15 kB -4.57% -24.22 kB 🔽

View base workflow run

@Lms24

Lms24 commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

well ... this is less than expected

Second sweep over what the transaction removal left behind. All of this was
reachable-but-dead: written by the SDK and read by nothing.

`setMeasurement()` was the biggest find. It stores timed events on the root
span, but the only reader was `timedEventsToMeasurements`, which fed the
transaction event's `measurements` field. Under span streaming
`getStreamedSpanJSON()` never looks at `_events`, so every call was a silent
no-op that only accumulated memory. Removed the function, the conversion
helper, `SentrySpan._events` and the `TimedEvent` type; `addEvent()` stays as
a no-op because the OpenTelemetry Span interface requires the method.
`@sentry/bundler-plugins` was the only internal caller and now sets plain
span attributes instead.

Also removed: `profile_id`, `exclusive_time`, `measurements` and `segment_id`
from `SpanJSON` (all write-only — nothing reads them off a `spanToJSON()`
result), the `transaction`/`transactions` fields on the v1 `Profile` type,
`capturedSpanScope` / `capturedSpanIsolationScope` /
`spanCountBeforeProcessing` from `SdkProcessingMetadata` plus the scope
re-routing they drove in `captureEvent`, the orphaned
`SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_*` and `SEMANTIC_ATTRIBUTE_PROFILE_ID`
constants, the browser-only `profilesSampleRate` option left over from legacy
profiling, and the `sentry.transaction` breadcrumb category (nothing emits it
anymore).

`spanToJSON`, `SpanJSON`, `getSpanDescendants` and `forceTransaction` are
deliberately kept: they are read APIs used across 15 packages, back idle
spans, and still mean "make this span a segment" respectively.

BREAKING CHANGE: `setMeasurement()` is removed; use span attributes instead.
`Span.addEvent()` no longer records anything. `profilesSampleRate` is removed
from the browser SDK options.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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