sidekiq_prometheus 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99f2c02a2ecdac71a05de9212319cc8efafb5e15d39d1a46d9dcd60d32ff847d
4
- data.tar.gz: b43c963a8c63ca92ad695a8a5ef191701a2486772aaea24ad333ad6aacf66363
3
+ metadata.gz: cfef2dcf926147bf8113fc2ef76ebc53e194b742bff8024e52915829ed315403
4
+ data.tar.gz: d312f2be0b37be88b32e4031560c03ad1386283c935e911435ba8929c108dc2b
5
5
  SHA512:
6
- metadata.gz: 74a9dda61a073d84576614a107966b9e6f714896b1925b1a2983f8f5ff64d2fa4f19007b47eaa6926f9f8a76cd0162a4c95dc11e97b11b9d40d9804ed6765d69
7
- data.tar.gz: d7d1784f6aa693eb0e96613d2f0af6ee49d26e11f6d061c61dc7c75e73c12760fbc95b4e526c6b8d017083a7a5c518b79fa0c339266c60d9e2c6611a702bd641
6
+ metadata.gz: edc39e79efebc8d713ab0b4c60913b860c115fd99e6b8d096e705e41c698accb8e1765316e98371f67bd13c53e612254f656cf49713580b50675b15f8c9664f3
7
+ data.tar.gz: d03bdf927308ed353d34922c894c0363e68e1326792d95dd7052f87c2a38d2156a6cfd13954b3ee593adbc9a7e80407a84569387ead503ea5adcb1f2baccf955
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  CHANGELOG
2
2
 
3
+ <a name="v1.8.1"></a>
4
+ ## [v1.8.1](https://github.com/fastly/sidekiq-prometheus/compare/v1.8.0...v1.8.1) (2022-10-18)
5
+
6
+ ### Feature
7
+
8
+ * Support newer Sidekiq-Enterprise (#[31](https://github.com/fastly/sidekiq-prometheus/pull/31))
9
+
3
10
  <a name="v1.8.0"></a>
4
11
  ## [v1.8.0](https://github.com/fastly/sidekiq-prometheus/compare/v1.7.0...v1.8.0) (2022-10-04)
5
12
 
@@ -10,7 +10,14 @@
10
10
  # @see https://github.com/mperham/sidekiq/wiki/Ent-Leader-Election
11
11
  # @see https://github.com/mperham/sidekiq/blob/main/lib/sidekiq/api.rb
12
12
 
13
+ begin
14
+ require 'sidekiq/component'
15
+ rescue LoadError
16
+ end
17
+
13
18
  class SidekiqPrometheus::PeriodicMetrics
19
+ include Sidekiq::Component if defined? Sidekiq::Component
20
+
14
21
  # @return [Boolean] When +true+ will stop the reporting loop.
15
22
  attr_accessor :done
16
23
 
@@ -28,26 +35,26 @@ class SidekiqPrometheus::PeriodicMetrics
28
35
  ##
29
36
  # Instance of SidekiqPrometheus::PeriodicMetrics
30
37
  # @return [SidekiqPrometheus:PeriodicMetrics]
31
- def self.reporter
32
- @reporter ||= new
38
+ def self.reporter(config)
39
+ @reporter ||= new(config: config)
33
40
  end
34
41
 
35
42
  ##
36
43
  # @param interval [Integer] Interval in seconds to record metrics.
37
44
  # @param sidekiq_stats [Sidekiq::Stats]
38
45
  # @param senate [#leader?] Sidekiq::Senate
39
- def initialize(interval: SidekiqPrometheus.periodic_reporting_interval, sidekiq_stats: Sidekiq::Stats, sidekiq_queue: Sidekiq::Queue, senate: nil)
46
+ def initialize(interval: SidekiqPrometheus.periodic_reporting_interval, sidekiq_stats: Sidekiq::Stats, sidekiq_queue: Sidekiq::Queue, senate: nil, config: nil)
40
47
  self.done = false
41
48
  @interval = interval
42
-
49
+ @config = config
43
50
  @sidekiq_stats = sidekiq_stats
44
51
  @sidekiq_queue = sidekiq_queue
45
52
  @senate = if senate.nil?
46
53
  if Object.const_defined?('Sidekiq::Senate')
47
- if Sidekiq::Senate.respond_to?(:leader?)
48
- Sidekiq::Senate
54
+ if respond_to?(:leader?)
55
+ self
49
56
  else
50
- Sidekiq::Senate.new(Sidekiq)
57
+ Sidekiq::Senate
51
58
  end
52
59
  else
53
60
  Senate
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqPrometheus
4
- VERSION = '1.8.1'
4
+ VERSION = '1.8.2'
5
5
  end
@@ -195,8 +195,8 @@ module SidekiqPrometheus
195
195
  end
196
196
 
197
197
  if periodic_metrics_enabled?
198
- config.on(:startup) { SidekiqPrometheus::PeriodicMetrics.reporter.start }
199
- config.on(:shutdown) { SidekiqPrometheus::PeriodicMetrics.reporter.stop }
198
+ config.on(:startup) { SidekiqPrometheus::PeriodicMetrics.reporter(config).start }
199
+ config.on(:shutdown) { SidekiqPrometheus::PeriodicMetrics.reporter(config).stop }
200
200
  end
201
201
 
202
202
  if metrics_server_enabled?
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'rspec', '~> 3.0'
28
28
  spec.add_development_dependency 'rubocop', '~> 0.58.0'
29
29
 
30
- spec.add_runtime_dependency 'prometheus-client', '~> 2.0'
30
+ spec.add_runtime_dependency 'prometheus-client', '>= 2.0'
31
31
  spec.add_runtime_dependency 'rack'
32
- spec.add_runtime_dependency 'sidekiq', '> 5.1'
32
+ spec.add_runtime_dependency 'sidekiq', '> 5.1', '< 7.0'
33
33
  spec.add_runtime_dependency 'webrick'
34
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq_prometheus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Eklund
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-10-18 00:00:00.000000000 Z
12
+ date: 2022-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -85,14 +85,14 @@ dependencies:
85
85
  name: prometheus-client
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '2.0'
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "~>"
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '2.0'
98
98
  - !ruby/object:Gem::Dependency
@@ -116,6 +116,9 @@ dependencies:
116
116
  - - ">"
117
117
  - !ruby/object:Gem::Version
118
118
  version: '5.1'
119
+ - - "<"
120
+ - !ruby/object:Gem::Version
121
+ version: '7.0'
119
122
  type: :runtime
120
123
  prerelease: false
121
124
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,6 +126,9 @@ dependencies:
123
126
  - - ">"
124
127
  - !ruby/object:Gem::Version
125
128
  version: '5.1'
129
+ - - "<"
130
+ - !ruby/object:Gem::Version
131
+ version: '7.0'
126
132
  - !ruby/object:Gem::Dependency
127
133
  name: webrick
128
134
  requirement: !ruby/object:Gem::Requirement