Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset DedupeIntegration's last-seen if before_send dropped the event #4142

Merged
merged 9 commits into from
Mar 19, 2025

Conversation

sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Mar 17, 2025

Imagine an app throws an exception twice, from different places. The first exception is dropped in the user's before_send. The second exception is not. Should the second exception appear in Sentry?

The current state is that it won't, since DedupeIntegration will take the first, dropped exception into account. When encountering the second exception, it'll consider it a duplicate and will drop it, even though the first exception never made it to Sentry.

In this PR, we reset DedupeIntegration's last-seen if an event has been dropped by before_send, ensuring that the next exception will be reported.

Closes #371

Verified

This commit was signed with the committer’s verified signature.
sentrivana Ivana Kellyer
Copy link

codecov bot commented Mar 17, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 79.55%. Comparing base (65132ba) to head (905fff7).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
sentry_sdk/integrations/dedupe.py 66.66% 1 Missing and 1 partial ⚠️
sentry_sdk/client.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4142      +/-   ##
==========================================
- Coverage   79.58%   79.55%   -0.03%     
==========================================
  Files         141      141              
  Lines       15723    15732       +9     
  Branches     2673     2675       +2     
==========================================
+ Hits        12513    12516       +3     
- Misses       2367     2370       +3     
- Partials      843      846       +3     
Files with missing lines Coverage Δ
sentry_sdk/client.py 79.17% <66.66%> (-0.08%) ⬇️
sentry_sdk/integrations/dedupe.py 80.00% <66.66%> (-2.76%) ⬇️

... and 4 files with indirect coverage changes

Verified

This commit was signed with the committer’s verified signature.
sentrivana Ivana Kellyer
@sentrivana sentrivana marked this pull request as ready for review March 18, 2025 08:44
@sentrivana sentrivana requested a review from antonpirker March 18, 2025 08:44
Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

I guess there code be an edge case that causes problem. (see my comment)

Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

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

looks good

@antonpirker antonpirker merged commit 0d3bc3d into master Mar 19, 2025
139 of 140 checks passed
@antonpirker antonpirker deleted the ivana/dedupe-considers-dropped-events branch March 19, 2025 11:13
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.

Dedupe triggers on dropped events
2 participants