Skip to content

feat(delayed_job): add opt-in ActiveJob reporting through sentry-rails - #3173

Open
solnic wants to merge 1 commit into
chore/2936-migrate-sentry-resque-to-aj-first-integrationfrom
chore/2935-migrate-sentry-delayed_job-to-aj-first-integration
Open

solnic wants to merge 1 commit into
chore/2936-migrate-sentry-resque-to-aj-first-integrationfrom
chore/2935-migrate-sentry-delayed_job-to-aj-first-integration

Conversation

@solnic

@solnic solnic commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

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::DelayedJobAdapter is listed in config.rails.skippable_job_adapters, so sentry-delayed_job keeps reporting those jobs. Rails apps opt in by removing it:

Sentry.init do |config|
  config.rails.skippable_job_adapters.delete("ActiveJob::QueueAdapters::DelayedJobAdapter")
end

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:

  • the Active-Job context and the delayed_job.queue and delayed_job.id tags
  • the auto.queue.delayed_job origin
  • Sentry::DelayedJob as the capturing integration

sentry-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

@solnic
solnic added this pull request to stack #3137 November 3, 2026 14:07
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.
@solnic
solnic force-pushed the chore/2935-migrate-sentry-delayed_job-to-aj-first-integration branch from 1816a94 to f632aa9 Compare November 3, 2026 14:46
@solnic
solnic marked this pull request as ready for review November 3, 2026 15:35

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f632aa9. Configure here.

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.

Migrate sentry-delayed_job to AJ-first integration

1 participant