Skip to content

Commit 5b1c892

Browse files
committed
require Rack ~> 3.0
1 parent db6f0f1 commit 5b1c892

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

lib/sidekiq_prometheus.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require "benchmark"
44
require "rack"
5+
require "rackup"
56
require "prometheus/client"
67
require "prometheus/middleware/exporter"
78
require "sidekiq"
@@ -225,12 +226,12 @@ def metrics_server
225226
}
226227

227228
unless metrics_server_logger_enabled?
228-
opts[:Logger] = WEBrick::Log.new("/dev/null")
229+
opts[:Logger] = WEBrick::Log.new(File::NULL)
229230
opts[:AccessLog] = []
230231
end
231232

232233
@_metrics_server ||= Thread.new do
233-
Rack::Handler::WEBrick.run(
234+
Rackup::Handler::WEBrick.run(
234235
Rack::Builder.new {
235236
use Prometheus::Middleware::Exporter, registry: SidekiqPrometheus.registry
236237
run ->(_) { [301, {"Location" => "/metrics"}, []] }

sidekiq_prometheus.gemspec

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ Gem::Specification.new do |spec|
2828
spec.add_development_dependency "standard"
2929

3030
spec.add_runtime_dependency "prometheus-client", ">= 2.0"
31-
spec.add_runtime_dependency "rack", "< 3.0"
31+
spec.add_runtime_dependency "rack", "~> 3.0"
32+
spec.add_runtime_dependency "rackup", ">2.0"
3233
spec.add_runtime_dependency "redis"
3334
spec.add_runtime_dependency "sidekiq", "> 5.1"
3435
spec.add_runtime_dependency "webrick"

spec/sidekiq_prometheus/periodic_metrics_spec.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535

3636
describe "#start" do
3737
it "starts a reporter in a new thread" do
38-
allow(Thread).to receive(:new)
38+
silence do
39+
allow(Thread).to receive(:new)
3940

40-
reporter.start
41+
reporter.start
4142

42-
expect(Thread).to have_received(:new) { |&block| expect(block).to be_kind_of(Proc) }
43+
expect(Thread).to have_received(:new) { |&block| expect(block).to be_kind_of(Proc) }
44+
end
4345
end
4446
end
4547

spec/spec_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ def silence
2626
end
2727

2828
Sidekiq.configure_server do |cfg|
29-
cfg.logger = Logger.new("/dev/null")
29+
cfg.logger = Logger.new(File::NULL)
3030
end

0 commit comments

Comments
 (0)