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

add report_after_job_retries support for ActiveJob #2500

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

modosc
Copy link
Contributor

@modosc modosc commented Dec 18, 2024

Description

this pr adds report_after_job_retries support to ActiveJob (configured via config.rails.active_job_report_after_job_retries).

the easiest way to do this would have been to use retry_on in the base ActiveJob class (similar to here) but that's difficult to do properly which is (i think) why the current ActiveJob integration doesn't do it.

instead we can take advantage of the retry_stopped.active_job notification that's published when a job runs out of retries. this makes our setup a single call to ActiveSupport::Notifications.subscribe.

fixes #2499

@modosc modosc force-pushed the active-job-report_after_job_retries branch from 5ecd340 to 2be327a Compare December 18, 2024 16:31
Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 65.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 96.99%. Comparing base (a1d2941) to head (f8a24b2).

Files with missing lines Patch % Lines
sentry-rails/lib/sentry/rails/active_job.rb 53.33% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2500      +/-   ##
==========================================
- Coverage   98.16%   96.99%   -1.18%     
==========================================
  Files         128      126       -2     
  Lines        4847     4787      -60     
==========================================
- Hits         4758     4643     -115     
- Misses         89      144      +55     
Components Coverage Δ
sentry-ruby 98.57% <ø> (ø)
sentry-rails 87.26% <65.00%> (-9.81%) ⬇️
sentry-sidekiq 97.09% <ø> (ø)
sentry-resque 92.85% <ø> (ø)
sentry-delayed_job 95.65% <ø> (ø)
sentry-opentelemetry 99.31% <ø> (+0.68%) ⬆️
Files with missing lines Coverage Δ
sentry-rails/lib/sentry/rails/configuration.rb 95.45% <100.00%> (-4.55%) ⬇️
sentry-rails/lib/sentry/rails/railtie.rb 87.95% <100.00%> (-10.80%) ⬇️
sentry-rails/lib/sentry/rails/active_job.rb 87.71% <53.33%> (-12.29%) ⬇️

... and 10 files with indirect coverage changes

@modosc modosc force-pushed the active-job-report_after_job_retries branch from 79897d2 to 0ce620d Compare December 18, 2024 16:39
@modosc modosc changed the title add report_after_job_retries support for activejob add report_after_job_retries support for ActiveJob Dec 18, 2024
@modosc modosc closed this Dec 18, 2024
@sl0thentr0py sl0thentr0py reopened this Dec 19, 2024
@sl0thentr0py sl0thentr0py self-requested a review December 19, 2024 06:47
@sl0thentr0py sl0thentr0py self-assigned this Dec 19, 2024
@modosc modosc force-pushed the active-job-report_after_job_retries branch from 923d2d3 to daee3d8 Compare January 11, 2025 00:14
@sl0thentr0py
Copy link
Member

@solnic could you review and get this merged if you have time?

@sl0thentr0py sl0thentr0py assigned solnic and unassigned sl0thentr0py Jan 13, 2025
@sl0thentr0py sl0thentr0py requested a review from solnic January 13, 2025 09:49
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.

implement report_after_job_retries in ActiveJob adapter
3 participants