Repository navigation
Conversation
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
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.
|
Optional E2E testsSome optional checks were not successful. They do not block the merge. 2 not successful, 63 successful. See the run.
Successful checks
|
|
@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') { |
There was a problem hiding this comment.
[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', () => { |
There was a problem hiding this comment.
[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.
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
ignoreErrorsandbeforeSend. 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