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

fix(rq): Only capture exception if RQ job has failed (ignore retries) #1076

Merged
merged 5 commits into from May 3, 2021

Conversation

BobReid
Copy link
Contributor

@BobReid BobReid commented Apr 8, 2021

Fixes #1074

Sentry reports all errors from RQ even if it is still retrying the job.

This changes checks to ensure that retries have been exhausted, ie. the job has failed and will be moved to the failed jobs queue, before capturing the exception.

Changes:

integrations/rq.py

  • only call _capture exception if job.is_failed is true, indicating it is moving to the failed jobs registry
  • add ignore_logger('rq.worker') so the exception does not get captured via the logging integration

tests/integrations/rq/test_rq.py

  • Add a failing test case for redis version 1.5 and above (where Retry was introduced) to ensure only one exception is captured in the event of a retry

@BobReid
Copy link
Contributor Author

BobReid commented Apr 8, 2021

Addresses #1074

@untitaker untitaker changed the title Only capture exception if RQ job has failed fix(rq): Only capture exception if RQ job has failed (ignore retries) May 3, 2021
@untitaker
Copy link
Member

I cannot merge master into your branch but I've manually verified that this works.

@untitaker untitaker merged commit 76aa189 into getsentry:master May 3, 2021
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.

Suppress errors while RQ is retrying
2 participants