getsentry / getsentry/sentry-ruby

Migrate `sentry-sidekiq` to AJ-first integration

Đang mở
#2,937 1 bình luận 0 reaction 1 người được giao Được @solnic nhận Xem trên GitHub
Improvement Ruby Spans
Ngôn ngữ chính
Ruby
Star
988
Fork
542
Merge trung bình
17 giờ 40 phút
Pull request đã merge (30 ngày)
19

Mô tả

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`)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.