From 44cabe063ee76ff17ccb9ea86b648358306f0a3d Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 5 Oct 2023 11:39:45 +0100 Subject: [PATCH 1/2] Update sentry-sidekiq for Sidekiq 7.1.5 In https://github.com/sidekiq/sidekiq/pull/6051, Sidekiq changed the expected parameters on the error handler. However, because it assumes error handler to be a Proc, it uses `#arity` for checking the number of parameters. This is not compatible with our error handler, which is a class. --- sentry-sidekiq/Gemfile | 11 ++++++++--- sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb | 4 ++++ .../sentry/sidekiq/sentry_context_middleware_spec.rb | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/sentry-sidekiq/Gemfile b/sentry-sidekiq/Gemfile index 692fae02d..c5d1d6bd6 100644 --- a/sentry-sidekiq/Gemfile +++ b/sentry-sidekiq/Gemfile @@ -16,15 +16,20 @@ gem "rexml" gem "loofah", "2.20.0" if RUBY_VERSION.to_f < 2.5 sidekiq_version = ENV["SIDEKIQ_VERSION"] -sidekiq_version = "6.0" if sidekiq_version.nil? +sidekiq_version = "7.0" if sidekiq_version.nil? gem "sidekiq", "~> #{sidekiq_version}" gem "rails" -if RUBY_VERSION.to_f >= 2.6 +ruby_version = Gem::Version.new(RUBY_VERSION) + +if ruby_version >= Gem::Version.new("2.6.0") gem "debug", github: "ruby/debug", platform: :ruby gem "irb" + + if ruby_version >= Gem::Version.new("3.0.0") + gem "ruby-lsp-rspec" + end end gem "pry" - diff --git a/sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb b/sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb index e99dc2b83..fcc892f62 100644 --- a/sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb +++ b/sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb @@ -29,6 +29,10 @@ def call(ex, context) scope&.clear end + def arity + method(:call).arity + end + private def retryable?(context) diff --git a/sentry-sidekiq/spec/sentry/sidekiq/sentry_context_middleware_spec.rb b/sentry-sidekiq/spec/sentry/sidekiq/sentry_context_middleware_spec.rb index 4a8542291..6212a8fe9 100644 --- a/sentry-sidekiq/spec/sentry/sidekiq/sentry_context_middleware_spec.rb +++ b/sentry-sidekiq/spec/sentry/sidekiq/sentry_context_middleware_spec.rb @@ -140,11 +140,11 @@ q = queue.to_a expect(q.size).to be(2) - first_headers = q.first["trace_propagation_headers"] + first_headers = q[0]["trace_propagation_headers"] expect(first_headers["sentry-trace"]).to eq(transaction.to_sentry_trace) expect(first_headers["baggage"]).to eq(transaction.to_baggage) - second_headers = q.second["trace_propagation_headers"] + second_headers = q[1]["trace_propagation_headers"] expect(second_headers["sentry-trace"]).to eq(transaction.to_sentry_trace) expect(second_headers["baggage"]).to eq(transaction.to_baggage) end From c7bc05fb566ddbb0b8f3d4a85a7f426a7cab4796 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 5 Oct 2023 11:59:36 +0100 Subject: [PATCH 2/2] Turn off fail-fast on sentry-sidekiq tests --- .github/workflows/sentry_sidekiq_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sentry_sidekiq_test.yml b/.github/workflows/sentry_sidekiq_test.yml index ae243b021..851d748b5 100644 --- a/.github/workflows/sentry_sidekiq_test.yml +++ b/.github/workflows/sentry_sidekiq_test.yml @@ -20,6 +20,7 @@ jobs: name: Ruby ${{ matrix.ruby_version }} & Sidekiq ${{ matrix.sidekiq_version }}, options - ${{ toJson(matrix.options) }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: sidekiq_version: ['5.0', '6.0', '7.0'] ruby_version: ['2.7', '3.0', '3.1', '3.2', jruby]