Skip to content

fix(core): Do not count dropped errors in request sessions - #25632

Open
s1gr1d wants to merge 3 commits into
developfrom
sig/request-session-filtered-errors
Open

s1gr1d wants to merge 3 commits into
developfrom
sig/request-session-filtered-errors

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Oct 21, 2026

Copy link
Copy Markdown
Member

Errors that ignoreErrors, beforeSend or an event processor drops no longer mark the request session as errored or crashed. Errors that sampleRate drops still count. This is the same rule that already applies to client sessions since #22671.

Before, ServerRuntimeClient set the request session status in captureException/captureEvent, before the event pipeline ran. Now the status is set at the same point in the pipeline as the client session update.

Event processing can finish after the response ends (e.g. async ContextLines reads). Because of this, the request session now waits for its pending error events before it is recorded. If client.flush() runs during that wait, the session is sent immediately. This is necessary because the flush sends the aggregate before it waits for event processing.

Fixes #25605

@s1gr1d
s1gr1d requested a review from a team as a code owner October 21, 2026 16:07
@s1gr1d

s1gr1d commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: f9003cd (PR test merge using develop at 8042719)

Against: 8042719 (develop) · base run #63102

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

Path Size % Change Change
@sentry/browser 29.92 kB +0.06% +16 B 🔺
@sentry/browser - with treeshaking flags 28.06 kB +0.05% +14 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 27.96 kB +0.04% +11 B 🔺
@sentry/browser (incl. Tracing) 52.11 kB +0.04% +17 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 52.12 kB +0.04% +17 B 🔺
@sentry/browser (incl. Tracing, Profiling) 55.06 kB +0.03% +16 B 🔺
@sentry/browser (incl. Tracing, Replay) 91.86 kB +0.02% +10 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.73 kB +0.02% +11 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 96.59 kB +0.01% +9 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 109.52 kB +0.01% +7 B 🔺
@sentry/browser (incl. Feedback) 47.44 kB +0.04% +17 B 🔺
@sentry/browser (incl. sendFeedback) 34.99 kB +0.05% +16 B 🔺
@sentry/browser (incl. FeedbackAsync) 40.09 kB +0.04% +16 B 🔺
@sentry/browser (incl. Metrics) 30.94 kB +0.03% +9 B 🔺
@sentry/browser (incl. Logs) 31.21 kB +0.01% +3 B 🔺
@sentry/browser (incl. Metrics & Logs) 31.85 kB +0.03% +9 B 🔺
@sentry/react 31.75 kB +0.05% +13 B 🔺
@sentry/react (incl. Tracing) 54.43 kB +0.02% +10 B 🔺
@sentry/vue 38.08 kB +0.04% +13 B 🔺
@sentry/vue (incl. Tracing) 55.04 kB +0.02% +8 B 🔺
@sentry/svelte 29.95 kB +0.06% +16 B 🔺
@sentry/remix (Remix 3 client bundle) 57.12 kB +0.02% +8 B 🔺
CDN Bundle 31.68 kB +0.04% +10 B 🔺
CDN Bundle (incl. Tracing) 52.62 kB +0.02% +7 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.88 kB +0.03% +8 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 54.56 kB +0.02% +10 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 74.79 kB +0.01% +2 B 🔺
CDN Bundle (incl. Tracing, Replay) 90.29 kB +0.01% +8 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.22 kB +0.02% +13 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 96.43 kB +0.01% +9 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.39 kB +0.02% +12 B 🔺
CDN Bundle - uncompressed 93.31 kB +0.03% +25 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 156.17 kB +0.02% +25 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.86 kB +0.03% +25 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 162.14 kB +0.02% +25 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.9 kB +0.02% +25 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 276.33 kB +0.01% +25 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 282.29 kB +0.01% +25 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 290.04 kB +0.01% +25 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.98 kB +0.01% +25 B 🔺
@sentry/nextjs (client) 57.32 kB +0.03% +16 B 🔺
@sentry/sveltekit (client) 52.49 kB +0.03% +14 B 🔺
@sentry/core/server 41.98 kB +0.32% +133 B 🔺
@sentry/core/browser 13.81 kB - -
@sentry/node 153.1 kB +0.1% +147 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.58 kB - -
@sentry/node - without tracing 94.72 kB +0.17% +153 B 🔺
@sentry/node - without channel injection 133.75 kB +0.12% +151 B 🔺
@sentry/aws-serverless 102.88 kB +0.14% +134 B 🔺
@sentry/cloudflare (withSentry) - minified 191.93 kB +0.13% +246 B 🔺
@sentry/cloudflare (withSentry) 477.23 kB +0.19% +897 B 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 212.88 kB +0.12% +234 B 🔺

View base workflow run

@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 e4c2c57. Configure here.


if (flushNow) {
flushPendingClientAggregates();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Flush-now skips existing aggregates

Medium Severity

When a request session settles after client.flush(), flushNow only sends if this call created the aggregate. Another request that records during that wait can already have opened a bucket, so this session is added and not sent. The in-flight flush then drains the transport without it, and a shutdown flush can drop the session.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e4c2c57. Configure here.

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.

I think one way we could solve this is by adding something like an afterFlushProcessing client hook that the client emits in its flush method after determining clientFinished. This should allow us to get rid of the flushNow flag that only worked locally for this request

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 2 failing, 62 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E node-anthropic-send-to-sentry (latest) Test (optional) Failing after 15s Details
❌ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Failing after 37s Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 53s Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-send-to-sentry (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-4-static (canary) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 28s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 22s Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 21s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 26s Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E angular (canary) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E vue-3 (canary) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 27s Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 23s Details
✅ CI: Optional E2E Tests / E2E node-anthropic-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E angular (canary) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions-send-to-sentry (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (canary, webpack) Test (optional) Successful in 5m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 43s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-3 (canary) Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E nuxt-4 (canary) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (canary, turbopack) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 24s Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (canary) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 (tracer provider) Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-standalone (canary, turbopack) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details

@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.

Thanks for fixing this, I admittedly forgot about the server side part when we made the change in browser.

Took me a bit to understand the pendingRequests logic but I think it's fine and shouldn't hurt us or leak memory (that is assuming the isolationScope cleans up at which point the references to the pending errors should be gc'd).

I think we still should address the bugbot comment but otherwise, looks great!

The scenario sets `sessionFlushingDelayMS` on `httpIntegration`, which has no effect with `@sentry/bun`, so the session aggregate arrives after the test timeout.

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.

Request sessions count errors dropped by ignoreErrors or beforeSend

2 participants