getsentry / sentry-python

The official Python SDK for Sentry.io
https://sentry.io/for/python/
MIT License
1.93k stars 509 forks source link

fix(integrations): Check retries_left before capturing exception #3803

Closed malkovro closed 2 days ago

malkovro commented 3 days ago

Since https://github.com/rq/rq/pull/1964 the job status is set to Failed before the handler decides whether to capture or not the exception while handle_job_failure has not yet been called so the job is not yet re-scheduled leading to all exceptions getting captured in RQ version >= 2.0.

Related to #1076 Fixes #3707

codecov[bot] commented 2 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.90%. Comparing base (01146bd) to head (81a7f71). Report is 1 commits behind head on master.

:white_check_mark: All tests successful. No failed tests found.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3803 +/- ## ========================================== + Coverage 79.87% 79.90% +0.03% ========================================== Files 137 137 Lines 15371 15373 +2 Branches 2608 2608 ========================================== + Hits 12277 12284 +7 + Misses 2223 2221 -2 + Partials 871 868 -3 ``` | [Files with missing lines](https://app.codecov.io/gh/getsentry/sentry-python/pull/3803?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Δ | | |---|---|---| | [sentry\_sdk/integrations/rq.py](https://app.codecov.io/gh/getsentry/sentry-python/pull/3803?src=pr&el=tree&filepath=sentry_sdk%2Fintegrations%2Frq.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5X3Nkay9pbnRlZ3JhdGlvbnMvcnEucHk=) | `82.55% <100.00%> (+0.41%)` | :arrow_up: | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/getsentry/sentry-python/pull/3803/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry)