-
-
Notifications
You must be signed in to change notification settings - Fork 513
ActiveJob missing error reporting on retries #2597
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
Comments
As a note I still see Sentry in backtrace frames when using I noticed one difference:
I don't know how unhandled works (maybe a red herring) but I wonder if that's what's stopping it from being automatically reported. Else yeah the Rails 8 thing sounds good, for earlier versions maybe the |
@sfcgeorge this is because our
Yes this makes sense because you handle the exception and capture it manually.
I missed that there's |
@solnic thanks for the great explanation and fix! 🎉 |
As described here hooking into
perform_now
is not enough to capture all exceptions that happen during execution of a job because retry logic is implemented as a rescue handler, which simply bypasses entire code flow from theperform_now
.It turned out we need to patchretry_job
in order to be able to report exceptions on each retry but this is needed only up until Rails 8.0.2 (included). Luckily latest Rails' version of ActiveJob usesActiveSupport.error.reporter
to report an exception before retrying a job, which means we can provide our own error subscriber and no patching will be needed for Rails > 8.0.2 (not released in the moment of writing this but it's in main).It turned out there's
enqueue_retry.active_job
that we can simply rely on for this.The text was updated successfully, but these errors were encountered: