Repository navigation
feat(delayed_job): add opt-in ActiveJob reporting through sentry-rails - #3173
Conversation
ActiveJob jobs on delayed_job keep being reported by sentry-delayed_job by default. Rails apps can remove ActiveJob::QueueAdapters::DelayedJobAdapter from config.rails.skippable_job_adapters to have sentry-rails report them through Sentry::DelayedJob::ActiveJobExtension, which keeps the delayed_job origin, integration, tags and Active-Job context. The plugin then only reports errors raised before an ActiveJob job starts. ActiveJobSupport mirrors sentry-sidekiq and sentry-resque, the README and gemspec move to maintenance mode, and an isolated spec runs the shared ActiveJob backend examples against the opted-in adapter.
1816a94 to
f632aa9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f632aa9. Configure here.
| end | ||
| end | ||
| raise | ||
| end |
There was a problem hiding this comment.
Pre-start errors leak job payload
Medium Severity
When an opted-in ActiveJob job fails before sentry-rails starts, capture_unreported_exception applies scope via generate_contexts, which copies every job_data key into the Active-Job context. That includes _sentry (trace headers and user info) and arguments, even when data_collection.queues is off. scope_data already strips both, so these pre-start error events send internal payload and argument data that the opt-in path otherwise withholds.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit f632aa9. Configure here.


sentry-delayed_job can now leave ActiveJob jobs running on delayed_job to the sentry-rails ActiveJob integration. The default doesn't change:
ActiveJob::QueueAdapters::DelayedJobAdapteris listed inconfig.rails.skippable_job_adapters, so sentry-delayed_job keeps reporting those jobs. Rails apps opt in by removing it:The choice is made once, when the Rails app boots. Once opted in, sentry-rails reports those jobs.
Sentry::DelayedJob::ActiveJobExtension, registered for:delayed_job, adds the delayed_job data:Active-Jobcontext and thedelayed_job.queueanddelayed_job.idtagsauto.queue.delayed_joboriginSentry::DelayedJobas the capturing integrationsentry-delayed_job still captures errors raised before the job starts, such as a job class that can no longer be loaded, and skips exceptions sentry-rails already captured. Plain delayed_job jobs are unchanged.
The README and gemspec now say sentry-delayed_job is in maintenance mode: plain delayed_job support keeps getting fixes, and new background-job features go into sentry-rails.
Closes #2935