Skip to content

fix(core): Stop idle spans from ending running children before they start - #26951

Draft
Lms24 wants to merge 1 commit into
developfrom
fix/idle-span-running-children
Draft

Lms24 wants to merge 1 commit into
developfrom
fix/idle-span-running-children

Conversation

@Lms24

@Lms24 Lms24 commented Nov 27, 2026

Copy link
Copy Markdown
Member

What

When an interaction or navigation idle span ends while a request it started is still in flight, the request span is no longer ended before it started. With span streaming, the request now ends on its own with its real duration and status.

  • An idle span is never trimmed to before a running child started.
  • Streaming: running children keep going when the idle span is cut short (interrupted, cancelled, ended manually). After heartbeatFailed or finalTimeout they are cancelled right away as before, and children that never end are cancelled after finalTimeout.

Why

A second tap ends the first ui.action.click span. The idle span then trimmed its end to the last finished child (often the 16 ms ui.interaction.click) and force-ended the running fetch there, before the fetch started. Relay drops spans with start > end, but sentry-trace already carried the fetch's span ID, so the backend http.server span showed up as an orphan. With streaming, each span is sent on its own, so the idle span has no reason to cut its children short. Pageload durations are kept as they are: the trim only moves out to a running child's start, not to the passed end timestamp.

🤖 Generated with Claude Code

…tart

When an idle span was interrupted while a child request was still in
flight, its end was trimmed to the last finished child, which could be
before the request started. The running request span was then force-ended
at that timestamp. Relay drops spans that end before they start, so the
backend http.server span lost its parent.

Never trim an idle span to before a running child started. With span
streaming, let running children end on their own when the idle span is cut
short. If it ended because of the child span or final timeout, they are
likely stuck, so cancel them right away as before. Children that never end
are cancelled after the final timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 50756e5 (PR test merge using develop at d799281)

Against: d799281 (develop) · base run #68208

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.55 kB - -
@sentry/browser - with treeshaking flags 28.74 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.61 kB - -
@sentry/browser (incl. Tracing) 53.77 kB +0.16% +85 B 🔺
@sentry/browser (incl. Tracing Core) 40.68 kB +0.21% +85 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 53.77 kB +0.16% +85 B 🔺
@sentry/browser (incl. Tracing, Profiling) 56.66 kB +0.16% +85 B 🔺
@sentry/browser (incl. Tracing, Replay) 93.69 kB +0.1% +92 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 82.48 kB +0.11% +83 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 98.56 kB +0.1% +96 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 111.5 kB +0.09% +91 B 🔺
@sentry/browser (incl. Feedback) 48.41 kB - -
@sentry/browser (incl. sendFeedback) 31.12 kB - -
@sentry/browser (incl. FeedbackAsync) 36.18 kB - -
@sentry/browser (incl. Metrics) 31.87 kB - -
@sentry/browser (incl. Logs) 32.15 kB - -
@sentry/browser (incl. Metrics & Logs) 32.81 kB - -
@sentry/react 32.58 kB - -
@sentry/react (incl. Tracing) 56.51 kB +0.16% +90 B 🔺
@sentry/vue 38.76 kB - -
@sentry/vue (incl. Tracing) 56.78 kB +0.16% +88 B 🔺
@sentry/svelte 30.58 kB - -
@sentry/effect (client) 42.23 kB - -
@sentry/effect (client, incl. Tracing) 54.97 kB - -
@sentry/effect (client, incl. Tracing, Logs, Metrics) 66.32 kB - -
@sentry/remix (Remix 3 client bundle) 59.49 kB +0.14% +79 B 🔺
CDN Bundle 32.39 kB - -
CDN Bundle (incl. Tracing) 54.13 kB +0.15% +79 B 🔺
CDN Bundle (incl. Logs, Metrics) 35.14 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 56.59 kB +0.13% +73 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 76.1 kB - -
CDN Bundle (incl. Tracing, Replay) 91.94 kB +0.1% +85 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 94.46 kB +0.08% +75 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 97.39 kB +0.07% +62 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.87 kB +0.08% +77 B 🔺
CDN Bundle - uncompressed 94.58 kB - -
CDN Bundle (incl. Tracing) - uncompressed 160.11 kB +0.16% +246 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.92 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 167.74 kB +0.15% +246 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 233.32 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 280.55 kB +0.09% +246 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 288.18 kB +0.09% +246 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.48 kB +0.09% +246 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 300.1 kB +0.09% +246 B 🔺
@sentry/nextjs (client) 60.2 kB +0.18% +105 B 🔺
@sentry/sveltekit (client) 55.13 kB +0.18% +96 B 🔺
@sentry/core/server 45.84 kB - -
@sentry/core/browser 14.55 kB +0.52% +75 B 🔺
@sentry/node 157.6 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.45 kB - -
@sentry/node - without tracing 89.84 kB -0.01% -1 B 🔽
@sentry/node - without channel injection 146.57 kB -0.01% -1 B 🔽
@sentry/aws-serverless 100.5 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 211.97 kB - -
@sentry/cloudflare (withSentry) 491.78 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 214.92 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 237.22 kB - -

View base workflow run

This branch has not been deployed

No deployments
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