Skip to content

feat(sidekiq): migrate to ActiveJob-first integration - #3134

Open
solnic wants to merge 24 commits into
chore/3119-switch-activejob-integration-to-the-backend-extension-registryfrom
chore/2937-migrate-sentry-sidekiq-to-aj-first-integration
Open

solnic wants to merge 24 commits into
chore/3119-switch-activejob-integration-to-the-backend-extension-registryfrom
chore/2937-migrate-sentry-sidekiq-to-aj-first-integration

Conversation

@solnic

@solnic solnic commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Introduces Sidekiq's JobExtension and shared retry/reporting policies, and makes standalone Sidekiq instrumentation use the core producer/consumer helpers.

Routes ActiveJob jobs through Sentry's ActiveJob integration while preserving Sidekiq trace propagation, retry limits, error reporting, delivery metadata, and scope cleanup. Includes queue conformance, early-failure coverage, and separate processes for isolated specs.

@solnic
solnic added this pull request to stack #3135 October 13, 2026 13:17

@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.

Stale Bugbot comment from a previous run.

Comment thread sentry-sidekiq/lib/sentry/sidekiq/sentry_context_middleware.rb
Comment thread sentry-sidekiq/lib/sentry/sidekiq/sentry_context_middleware.rb
Comment thread sentry-sidekiq/lib/sentry/sidekiq/sentry_context_middleware.rb
@solnic
solnic force-pushed the chore/2937-migrate-sentry-sidekiq-to-aj-first-integration branch from 4586b71 to 412cdfc Compare October 13, 2026 13:23
@solnic
solnic marked this pull request as draft October 13, 2026 13:25

@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.

Stale Bugbot comment from a previous run.

Comment thread sentry-sidekiq/lib/sentry/sidekiq/sentry_context_middleware.rb
Comment thread sentry-sidekiq/lib/sentry/sidekiq/sentry_context_middleware.rb
@solnic
solnic force-pushed the chore/2937-migrate-sentry-sidekiq-to-aj-first-integration branch 2 times, most recently from 906473e to 4f51c1c Compare October 14, 2026 06:13
@solnic
solnic force-pushed the chore/2937-migrate-sentry-sidekiq-to-aj-first-integration branch from 4f51c1c to 185934b Compare October 14, 2026 06:31
@solnic
solnic force-pushed the chore/2937-migrate-sentry-sidekiq-to-aj-first-integration branch 3 times, most recently from 7671f66 to 87c690c Compare October 14, 2026 08:23
@solnic
solnic force-pushed the chore/2937-migrate-sentry-sidekiq-to-aj-first-integration branch 2 times, most recently from 91bbe8e to 5520b91 Compare October 14, 2026 10:34
@solnic
solnic force-pushed the chore/2937-migrate-sentry-sidekiq-to-aj-first-integration branch from 5520b91 to e76091f Compare October 14, 2026 10:56
@solnic
solnic force-pushed the chore/2937-migrate-sentry-sidekiq-to-aj-first-integration branch from e76091f to 6014ce1 Compare October 14, 2026 11:42
@solnic
solnic removed this pull request from stack #3135 October 14, 2026 11:44
@solnic
solnic changed the base branch from chore/3121-queues-module-conformance-improvements to chore/3119-switch-activejob-integration-to-the-backend-extension-registry October 14, 2026 11:44
@solnic
solnic added this pull request to stack #3137 October 14, 2026 11:44
@solnic
solnic marked this pull request as ready for review October 14, 2026 11:49

@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 2 potential issues.

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 6014ce1. Configure here.

context[:jobstr] = ::Sidekiq.dump_json(sidekiq_job) if JobExtension::JOB_STRING_IN_ERROR_CONTEXT
ErrorHandler.new.call(exception, context, sidekiq_config)
exception.instance_variable_set(ErrorHandler::HANDLED_SIGNATURE, true)
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.

Shutdown reported as job failure

Medium Severity

The ActiveJob handoff ensure treats every unfinished exception as a job failure and sends it through ErrorHandler. That includes Sidekiq::Shutdown, which the standalone middleware never rescued (rescue is StandardError only) and which Sidekiq does not pass to error handlers. Stopping a worker can therefore record in-flight ActiveJob runs as errors.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6014ce1. Configure here.

Comment thread sentry-sidekiq/Rakefile
end

task isolated: isolated_tasks
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.

Isolated specs share one process

Medium Severity

spec:isolated runs each isolated example file through RSpec::Core::RakeTask in the current Ruby process. Those files are meant to be separate processes, but registrations, Rails boot, and Sidekiq configuration now leak between spec/isolated/active_job_spec.rb, spec/isolated/native_extension_spec.rb, and spec/isolated/rails_spec.rb.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6014ce1. 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.

1 participant