Skip to content

fix(v10/core): Sample errors after beforeSend while preserving session updates - #22819

Merged
s1gr1d merged 3 commits into
v10from
sig/error-sampling-after-beforeSend
Jul 29, 2026
Merged

fix(v10/core): Sample errors after beforeSend while preserving session updates#22819
s1gr1d merged 3 commits into
v10from
sig/error-sampling-after-beforeSend

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Jul 29, 2026

Copy link
Copy Markdown
Member

backport of #22671

Closes #22615

…updates (#22671)

When `sampleRate` causes an error event to be dropped, the
`_processEvent` method returned early before reaching
`_updateSessionFromEvent`, so the session is never marked
crashed/errored. This increased crash-free session rates.

This PR moves error event sampling after event processors and
`beforeSend`, while keeping the session update **before** the sampling
decision.


The updated pipeline is:
`event processors → beforeSend → session update → sampleRate → send`


This follows the [session update filtering
spec](https://develop.sentry.dev/sdk/telemetry/sessions/#session-update-filtering).




Closes #22615
@s1gr1d
s1gr1d requested a review from a team as a code owner July 29, 2026 12:22
@s1gr1d
s1gr1d requested review from a team, Lms24, logaretm and msonnb and removed request for a team July 29, 2026 12:22
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.75 kB added added
@sentry/browser - with treeshaking flags 26.19 kB added added
@sentry/browser (incl. Tracing) 46.6 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.38 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.34 kB added added
@sentry/browser (incl. Tracing, Replay) 85.84 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.48 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 90.55 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 103.2 kB added added
@sentry/browser (incl. Feedback) 44.92 kB added added
@sentry/browser (incl. sendFeedback) 32.55 kB added added
@sentry/browser (incl. FeedbackAsync) 37.68 kB added added
@sentry/browser (incl. Metrics) 28.84 kB added added
@sentry/browser (incl. Logs) 29.07 kB added added
@sentry/browser (incl. Metrics & Logs) 29.76 kB added added
@sentry/react 29.55 kB added added
@sentry/react (incl. Tracing) 48.86 kB added added
@sentry/vue 33.17 kB added added
@sentry/vue (incl. Tracing) 48.56 kB added added
@sentry/svelte 27.78 kB added added
CDN Bundle 30.14 kB added added
CDN Bundle (incl. Tracing) 48.56 kB added added
CDN Bundle (incl. Logs, Metrics) 31.73 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 49.86 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 70.99 kB added added
CDN Bundle (incl. Tracing, Replay) 86.05 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.36 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 91.86 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.12 kB added added
CDN Bundle - uncompressed 89.9 kB added added
CDN Bundle (incl. Tracing) - uncompressed 146.78 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.61 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.75 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.37 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.01 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.98 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.71 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.67 kB added added
@sentry/nextjs (client) 51.4 kB added added
@sentry/sveltekit (client) 47.02 kB added added
@sentry/core/server 80.44 kB added added
@sentry/core/browser 66.78 kB added added
@sentry/node-core 63.25 kB added added
@sentry/node 125.89 kB added added
@sentry/node (incl. diagnostics channel injection) 151.32 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB added added
@sentry/node/light 51.41 kB added added
@sentry/node - without tracing 74.94 kB added added
@sentry/aws-serverless 84.21 kB added added
@sentry/cloudflare (withSentry) - minified 200.5 kB added added
@sentry/cloudflare (withSentry) 492.68 kB added added

@s1gr1d
s1gr1d enabled auto-merge (squash) July 29, 2026 12:45
…-session-update/test.ts

Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
@s1gr1d
s1gr1d merged commit 045d07e into v10 Jul 29, 2026
308 of 309 checks passed
@s1gr1d
s1gr1d deleted the sig/error-sampling-after-beforeSend branch July 29, 2026 13:47
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.

3 participants