Skip to content

fix(core): Ignore errors that are never sent in Dedupe - #27138

Draft
s1gr1d wants to merge 1 commit into
developfrom
fix/dedupe-ignore-never-sent-errors
Draft

s1gr1d wants to merge 1 commit into
developfrom
fix/dedupe-ignore-never-sent-errors

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Dec 3, 2026

Copy link
Copy Markdown
Member

What

Dedupe no longer remembers a sampled-out error. Before, Dedupe dropped the next equal error as a duplicate. With a low sampleRate, an error that repeats could be dropped every time and never reach Sentry. The fix applies to the browser and the server.

Part 1 of 3 for #25605. The next parts are stacked on this PR.

Why

A sampled-out error that can still change a session runs the event processors, so that the session update follows ignoreErrors and beforeSend. Dedupe saw that error and stored it as the previous event. The client now tells Dedupe to ignore it.

The client passes this through a context that is keyed by the event hint. The context has one mode for now. #26819 adds the modes that request sessions need.

Refs #25605

A sampled-out error that can still change a session runs the event processors, so Dedupe
remembered it as the previous event and dropped the next equal error. With a low sampleRate, an
error that repeats could be dropped every time and never reach Sentry. The client now tells
Dedupe to ignore sampled-out errors.

Refs #25605
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 89bc3c1 (PR test merge using develop at 2007cec)

Against: 2007cec (develop) · base run #68738

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

Path Size % Change Change
@sentry/browser 30.77 kB +0.14% +41 B 🔺
@sentry/browser - with treeshaking flags 28.88 kB +0.1% +27 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 28.76 kB +0.2% +57 B 🔺
@sentry/browser (incl. Tracing) 54.12 kB +0.09% +47 B 🔺
@sentry/browser (incl. Tracing Core) 40.94 kB +0.14% +55 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 54.12 kB +0.09% +48 B 🔺
@sentry/browser (incl. Tracing, Profiling) 57.01 kB +0.08% +41 B 🔺
@sentry/browser (incl. Tracing, Replay) 94.09 kB +0.05% +38 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 82.65 kB +0.08% +66 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 98.94 kB +0.05% +44 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 111.89 kB +0.04% +39 B 🔺
@sentry/browser (incl. Feedback) 48.63 kB +0.08% +37 B 🔺
@sentry/browser (incl. sendFeedback) 31.33 kB +0.13% +40 B 🔺
@sentry/browser (incl. FeedbackAsync) 36.38 kB +0.12% +43 B 🔺
@sentry/browser (incl. Metrics) 32.09 kB +0.16% +49 B 🔺
@sentry/browser (incl. Logs) 32.37 kB +0.16% +51 B 🔺
@sentry/browser (incl. Metrics & Logs) 33.05 kB +0.15% +49 B 🔺
@sentry/react 32.65 kB +0.14% +45 B 🔺
@sentry/react (incl. Tracing) 56.62 kB +0.09% +50 B 🔺
@sentry/vue 39.12 kB +0.12% +46 B 🔺
@sentry/vue (incl. Tracing) 57.2 kB +0.02% +10 B 🔺
@sentry/svelte 30.81 kB +0.15% +44 B 🔺
@sentry/effect (client) 42.32 kB +0.08% +33 B 🔺
@sentry/effect (client, incl. Tracing) 55.15 kB +0.09% +45 B 🔺
@sentry/effect (client, incl. Tracing, Logs, Metrics) 66.63 kB +0.07% +41 B 🔺
@sentry/remix (Remix 3 client bundle) 59.59 kB +0.06% +35 B 🔺
CDN Bundle 32.58 kB +0.13% +41 B 🔺
CDN Bundle (incl. Tracing) 54.22 kB +0.08% +43 B 🔺
CDN Bundle (incl. Logs, Metrics) 35.3 kB +0.14% +46 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 56.65 kB +0.05% +24 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 76.25 kB +0.07% +49 B 🔺
CDN Bundle (incl. Tracing, Replay) 92.03 kB +0.06% +54 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 94.52 kB +0.03% +25 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 97.48 kB +0.04% +38 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.94 kB +0.05% +43 B 🔺
CDN Bundle - uncompressed 95.06 kB +0.13% +120 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 160.41 kB +0.08% +120 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 103.4 kB +0.12% +120 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 168.04 kB +0.08% +120 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 233.79 kB +0.06% +120 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 280.84 kB +0.05% +120 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 288.47 kB +0.05% +120 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.77 kB +0.05% +120 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 300.39 kB +0.04% +120 B 🔺
@sentry/nextjs (client) 59.97 kB +0.06% +34 B 🔺
@sentry/sveltekit (client) 54.95 kB +0.11% +57 B 🔺
@sentry/astro (client) - rolldown, without tracing 35.88 kB +0.16% +54 B 🔺
@sentry/core/server 45.99 kB +0.07% +29 B 🔺
@sentry/core/browser 14.55 kB - -
@sentry/node 157.81 kB +0.04% +57 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.63 kB - -
@sentry/node - without tracing 89.8 kB +0.07% +54 B 🔺
@sentry/node - without channel injection 147.21 kB +0.08% +104 B 🔺
@sentry/aws-serverless 100.71 kB +0.06% +59 B 🔺
@sentry/cloudflare (withSentry) - minified 213.51 kB +0.09% +188 B 🔺
@sentry/cloudflare (withSentry) 495.66 kB +0.1% +482 B 🔺
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 216.45 kB +0.09% +188 B 🔺
@sentry/nextjs/cloudflare (withSentry) - minified 241.71 kB +0.08% +188 B 🔺

View base workflow run

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Optional E2E tests

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

Check Status
❌ CI: Optional E2E Tests / E2E nuxt-5 (bun) Test (optional) Failing after 3m Details
❌ CI: Optional E2E Tests / E2E node-express-mcp-v2 (MCP SDK OpenTelemetry) Test (optional) Failing after 1m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (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 cloudflare-workers-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E hono-5 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E hono-5 (cloudflare) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E hono-5 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hapi-21 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps 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 cloudflare-think (ai v6) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry (static trace lifecycle) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-4-sourcemaps (Vite server) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (delete all) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps enabled by Sentry) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (delete all) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (no upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (0.x) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve (content off) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (deno) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps (manual upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E hono-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E hapi-21 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (cloudflare) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E vinext-cf-workers (workers cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 (manual upload) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 2m Details

@s1gr1d

s1gr1d commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

@sentry-junior review

// These should never be deduped, and also not be compared against as _previousEvent.
if (currentEvent.type) {
// Errors that are never sent (e.g. sampled out) must not make a later error a duplicate.
if (currentEvent.type || context?.mode === 'ignore') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[m] packages/core/src/integrations/dedupe.ts:22: A sampled-out duplicate now counts in sessions, but the same duplicate sampled in does not

With mode: 'ignore', Dedupe skips the sampled-out error entirely, so it no longer drops it when it duplicates the previous sent error. The error then reaches beforeSend and _updateSessions. The same duplicate, sampled in, is still dropped by Dedupe and does not count. So session health now depends on the sample roll, which goes against the goal in _updateSessions ("sampling only saves quota, so the error must still count" as if it were sent).

Trigger: Error('dup') is sent, a new session starts (or the second copy is unhandled), then the same error is captured again. I checked with a scratch test (Dedupe, beforeSend, a fresh ok session before the second capture):

second capture session.errors beforeSend calls outcome
sampled in (HEAD and base) 0 1 event_processor
sampled out, base 0 1 event_processor
sampled out, this PR 1 2 sample_rate

A fix that keeps both goals: for a sampled-out error, Dedupe still compares it with previousEvent (and drops it if it is a duplicate) but does not store it as previousEvent. The ignore doc in dedupeContext.ts ("does not compare it and does not remember it") would change with it.

).not.toBeNull();
expect(integration.processEvent?.(clone(exceptionEvent), {}, {} as any)).toBeNull();
expect(integration.processEvent?.(clone(exceptionEvent), {}, {} as any)).toBeNull();
describe('integration', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[m] packages/core/test/lib/integrations/dedupe.test.ts:194: The "transactions between errors" case was dropped in the port

The old processEvent test ignores transactions between errors was removed, and the new integration suite has no case with a typed event (transaction, replay) between two equal errors. That case covers the currentEvent.type half of the condition this PR changed on dedupe.ts:22. I removed currentEvent.type || from that line and all 22 tests in this file still pass. I also searched dev-packages/node-integration-tests/suites/integrations/dedupe/ and found no transaction case there either.

A port that fits the new suite: capture Error('duplicate'), then client.captureEvent({ type: 'transaction', transaction: 'wat', ... }), then the same error again, and expect sendEventCalled once for the errors.

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