Skip to content

Migrate sentry-sidekiq to AJ-first integration #2937

@solnic

Description

@solnic

Part of #2932.

Most complex existing integration — client + server middleware, error handler, retry semantics, crons, scheduler. AJ-wrapped Sidekiq jobs currently go through both sentry-sidekiq and sentry-rails (the skippable_job_adapters registration suppresses the double-report). This phase makes Sidekiq correctly defer the AJ path to sentry-rails while keeping sidekiq-native coverage untouched.

This phase must land atomically — the dual-path detection changes and the skippable_job_adapters unregistration (4.4) ship together so there is no window where sidekiq+AJ jobs are either double-reported or unreported.

Tasks

  • 4.1 Detect AJ-wrapped jobs in server middleware. In SentryContextServerMiddleware, recognize both ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper (legacy) and Sidekiq::ActiveJob::Wrapper (Sidekiq 7+). When detected, skip the Sidekiq perform transaction in favor of the AJ one (or downgrade to a thin wrapper span — decision in issue). No duplicate transactions.

  • 4.2 Detect AJ-wrapped jobs in error handler. Update ErrorHandler#call so AJ-wrapped failures are left to the AJ integration. Sidekiq-native error capture unchanged.

  • 4.3 Align client middleware queue.publish span with AJ's producer span. SentryContextClientMiddleware already opens a publish span; when the job is AJ-wrapped, suppress or nest — decide and document.

  • 4.4 Unregister from skippable_job_adapters (per Phase 1.6 decision). Strip the Railtie block at sentry-sidekiq.rb#L17-L24.

  • 4.5 Wire Sidekiq into the shared contract. Thin spec in sentry-sidekiq that runs the AJ shared suite against the Sidekiq adapter, asserting zero duplicate events / zero duplicate transactions.

  • 4.6 Add Sidekiq-native backend-specific spec coverage. Dedicated spec file(s) covering Sidekiq-only surface (retry middleware, dead set, scheduler interactions). Existing Sidekiq specs get ported into this structure.

  • 4.7 Retire the legacy activejob_spec.rb. By end of this phase it is fully superseded; delete it.

Depends on

Phase 1 (ActiveJob core integration in sentry-rails)

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions