Skip to content

Commit 80f28e3

Browse files
authored
handle sidekiq deprecation warning (#535)
1 parent c69973b commit 80f28e3

File tree

9 files changed

+27
-7
lines changed

9 files changed

+27
-7
lines changed

.github/workflows/test.yml

+6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ jobs:
4242
- ruby: "3.0"
4343
gemfile: gems/sidekiq.gemfile
4444
test_features: "sidekiq_install"
45+
- ruby: "3.0"
46+
gemfile: gems/sidekiq7.gemfile
47+
test_features: "sidekiq_install"
48+
- ruby: "3.3"
49+
gemfile: gems/sidekiq8.gemfile
50+
test_features: "sidekiq_install"
4551
- ruby: 3.1
4652
- ruby: 3.2
4753
gemfile: gems/sqlite3-v2.gemfile

CHANGELOG.markdown

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Unreleased
2+
- Fix deprecation warning for Sidekiq 7.1.5+ (#535)
23

34
# 5.6.1
45
- Fix `job_sample_rate` and `endpoint_sample_rate` default configuration values (#529)

gems/rails7.gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eval_gemfile("../Gemfile")
2+
3+
gem "rails", "~> 7.0"
4+
gem "sqlite3", "~> 1.4"

gems/sidekiq7.gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
eval_gemfile("../Gemfile")
2+
3+
gem 'sidekiq', '~> 7.0'

gems/sidekiq8.gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eval_gemfile("../Gemfile")
2+
3+
gem 'sqlite3', '~> 2.0'
4+
gem 'sidekiq', '~> 8.0'

lib/scout_apm/error_service/sidekiq.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def install_sidekiq_with_middleware
2828

2929
def install_sidekiq_with_error_handler
3030
::Sidekiq.configure_server do |config|
31-
config.error_handlers << proc { |exception, job_info|
31+
config.error_handlers << proc { |exception, job_info, sidekiq_config|
3232
context = ScoutApm::Agent.instance.context
3333

3434
# Bail out early, and reraise if the error is not interesting.

test/unit/background_job_integrations/sidekiq_test.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ class SidekiqTest < Minitest::Test
1818
def test_starts_on_startup
1919
::ScoutApm::Agent.any_instance.expects(:start)
2020
SidekiqIntegration.new.install
21-
Sidekiq.options[:lifecycle_events][:startup].map(&:call)
21+
::Sidekiq.configure_server do |config|
22+
config[:lifecycle_events][:startup].map(&:call)
23+
end
2224
end
2325
end
2426

test/unit/config_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_nullable_integer_coercion
8989
assert_equal 0, coercion.coerce("0")
9090
assert_equal 0, coercion.coerce(0)
9191
assert_equal 0, coercion.coerce("")
92-
assert_equal nil, coercion.coerce(nil)
92+
assert_nil coercion.coerce(nil)
9393
end
9494

9595
def test_any_keys_found

test/unit/sampling_test.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_individual_sample_to_hash
2626
assert_equal({'/foo/bar' => 100, '/foo' => 50, '/bar/zap' => 80}, sampling.individual_sample_to_hash(@individual_config.value('sample_endpoints')))
2727

2828
sampling = ScoutApm::Sampling.new(@global_sample_config)
29-
assert_equal nil, sampling.individual_sample_to_hash(@global_sample_config.value('sample_endpoints'))
29+
assert_nil sampling.individual_sample_to_hash(@global_sample_config.value('sample_endpoints'))
3030
end
3131

3232
def test_uri_ignore
@@ -41,10 +41,10 @@ def test_uri_sample
4141
assert_equal 50, rate
4242

4343
rate = sampling.web_sample_rate('/bar')
44-
assert_equal nil, rate
44+
assert_nil rate
4545

4646
rate = sampling.web_sample_rate('/baz/bap')
47-
assert_equal nil, rate
47+
assert_nil rate
4848

4949
rate = sampling.web_sample_rate('/foo/bar/baz')
5050
assert_equal 100, rate
@@ -59,7 +59,7 @@ def test_job_ignore
5959
def test_job_sample
6060
sampling = ScoutApm::Sampling.new(@individual_config)
6161
assert_equal 50, sampling.job_sample_rate('joba')
62-
assert_equal nil, sampling.job_sample_rate('jobb')
62+
assert_nil sampling.job_sample_rate('jobb')
6363
end
6464

6565
def test_sample

0 commit comments

Comments
 (0)