getsentry / getsentry/sentry-ruby

Migrate `sentry-sidekiq` to AJ-first integration

Offen
#2,937 1 Kommentar 0 Reaktionen 1 zugewiesene Person Beansprucht von @solnic Auf GitHub ansehen
Improvement Ruby Spans
Vorherrschende Sprache
Ruby
Sterne
987
Forks
541
Ø Merge
17 Std. 40 Min.
Gemergte PRs (30 T.)
19

Beschreibung

Part of getsentry/sentry-ruby#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`)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.