sidekiq_status_monitor 1.0.1 → 1.2.0

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: 1fb83885ad80397022235ff27e46d85eac13daf7b099c1a1c4b0eb1774b19163
4
- data.tar.gz: 125eebb6cd0f9ab6b62098c9e1dd5b813e93167b98e3971e2fbca4b45d73548b
3
+ metadata.gz: c41f2c9bc2ce7b5a377d49921da85454fe34f550caef7ee37c7d9c3a739fde3c
4
+ data.tar.gz: c319d55e81e666d2f3acfd6a36dda321a8803e729b8cfd83d957dfbf0f8d5292
5
5
  SHA512:
6
- metadata.gz: 800faf00a933fe75c179a97f418268c3c108529eba8d62b9fa892b94d0a0cd6388778afd59f35b0220b530ce7d666a3ecb6d4b4744b4c3dcbe3bc53d6b2cb0a9
7
- data.tar.gz: dceef546daac35a56fa9a386d902b81573a69b5f62143798fab82777c08e2b899e1412ea6fde07e82391faee8e73134cd7d955b1fe0c21ff206288ca90d31488
6
+ metadata.gz: b3f2758a49ba295e005dd5dd40ceba28ca7ac9c359d97edf3868ded252c6fe8326d81c5cc440f42a341c6e8cc25e0b2f09539937a0de64a607aff8cabd74f820
7
+ data.tar.gz: 6203778281a478136f3eb73835e5736ff43e7d6b9f1d03139d804a5aa5fc6e850df386f64c0d7358733d8f24e0a94ec5afef1ba09d059ab3e51c7c81e036a881
data/README.md CHANGED
@@ -10,32 +10,9 @@ This library can be used to check sidekiq health outside kubernetes.
10
10
 
11
11
  **How?**
12
12
 
13
- A http server is started and on each requests validates that a liveness key is stored in Redis. If it is there means is working.
13
+ An additional HTTP server is started during Sidekiq worker initialisation and on each request validates that the Sidekiq worker metrics look healthy.
14
14
 
15
- A Sidekiq worker is the responsible to storing this key. If Sidekiq stops processing workers
16
- this key gets expired by Redis an consequently the http server will return a 500 error.
17
-
18
- This worker is responsible to requeue itself for the next liveness probe.
19
-
20
- Each instance in kubernetes will be checked based on `ENV` variable `HOSTNAME` (kubernetes sets this for each replica/pod).
21
-
22
- On initialization SidekiqStatusMonitor will asign to Sidekiq::Worker a queue with the current host and add this queue to the current instance queues to process.
23
-
24
- example:
25
-
26
- ```
27
- hostname: foo
28
- Worker queue: sidekiq_status_monitor-foo
29
- instance queues:
30
- - sidekiq_status_monitor-foo
31
- *- your queues
32
-
33
- hostname: bar
34
- Worker queue: sidekiq_status_monitor-bar
35
- instance queues:
36
- - sidekiq_status_monitor-bar
37
- *- your queues
38
- ```
15
+ It reports either 200 or 500 HTTP code with additional JSON payload which includes metrics values.
39
16
 
40
17
  ## Installation
41
18
 
@@ -5,16 +5,16 @@ module SidekiqStatusMonitor
5
5
  include Singleton
6
6
 
7
7
  attr_accessor :host,
8
- :port,
9
- :path,
10
- :server,
11
- :logger,
12
- :shutdown_callback,
13
- :workers_size_threshold,
14
- :process_set_size_threshold,
15
- :queues_size_threshold,
16
- :queue_latency_threshold,
17
- :queue_size_threshold
8
+ :port,
9
+ :path,
10
+ :server,
11
+ :logger,
12
+ :shutdown_callback,
13
+ :workers_size_threshold,
14
+ :process_set_size_threshold,
15
+ :queues_size_threshold,
16
+ :queue_latency_threshold,
17
+ :queue_size_threshold
18
18
 
19
19
  def initialize
20
20
  set_defaults
@@ -43,9 +43,9 @@ module SidekiqStatusMonitor
43
43
 
44
44
  private
45
45
 
46
- def redis(&block)
46
+ def redis(&)
47
47
  # Default to Sidekiq.redis if capsule is not configured yet but redis adapter is accessed
48
- (@capsule || Sidekiq).redis(&block)
48
+ (@capsule || Sidekiq).redis(&)
49
49
  end
50
50
  end
51
51
  end
@@ -37,8 +37,8 @@ module SidekiqStatusMonitor
37
37
 
38
38
  private
39
39
 
40
- def redis(&block)
41
- Sidekiq.redis(&block)
40
+ def redis(&)
41
+ Sidekiq.redis(&)
42
42
  end
43
43
  end
44
44
  end
@@ -36,7 +36,7 @@ module SidekiqStatusMonitor
36
36
  def call(_env)
37
37
  [
38
38
  alive? ? 200 : 500,
39
- { "Content-Type" => "application/json" },
39
+ {"Content-Type" => "application/json"},
40
40
  [payload.to_json]
41
41
  ]
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module SidekiqStatusMonitor
2
- VERSION = '1.0.1'
2
+ VERSION = "1.2.0"
3
3
  end
@@ -101,8 +101,8 @@ module SidekiqStatusMonitor
101
101
  queues.map(&:name).uniq.sort
102
102
  end
103
103
 
104
- def self.new_probe(name, &block)
105
- define_method("#{PROBE_METHOD_PREFIX}#{name}", &block)
104
+ def self.new_probe(name, &)
105
+ define_method(:"#{PROBE_METHOD_PREFIX}#{name}", &)
106
106
  end
107
107
 
108
108
  new_probe :workers_size do
@@ -126,7 +126,7 @@ module SidekiqStatusMonitor
126
126
  end
127
127
 
128
128
  def probes
129
- methods.grep(/^#{PROBE_METHOD_PREFIX}/).map { |m| [m, send(m)] }.to_h
129
+ methods.grep(/^#{PROBE_METHOD_PREFIX}/o).map { |m| [m, send(m)] }.to_h
130
130
  end
131
131
 
132
132
  def alive?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq_status_monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-12 00:00:00.000000000 Z
11
+ date: 2024-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,47 +95,61 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '4.0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubocop-shopify
98
+ name: solargraph
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '2.10'
103
+ version: 0.49.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '2.10'
110
+ version: 0.49.0
111
111
  - !ruby/object:Gem::Dependency
112
- name: solargraph
112
+ name: standard
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.49.0
117
+ version: '1'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.49.0
124
+ version: '1'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rack
126
+ name: standard-performance
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "<"
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '3'
132
- type: :runtime
131
+ version: '1'
132
+ type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "<"
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1'
139
+ - !ruby/object:Gem::Dependency
140
+ name: standard-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.2'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '3'
152
+ version: '0.2'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: sidekiq
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -206,7 +220,7 @@ metadata:
206
220
  homepage_uri: https://github.com/amkisko/sidekiq_status_monitor
207
221
  source_code_uri: https://github.com/amkisko/sidekiq_status_monitor
208
222
  changelog_uri: https://github.com/amkisko/sidekiq_status_monitor/releases
209
- documentation_uri: https://github.com/amkisko/sidekiq_status_monitor/blob/v1.0.1/README.md
223
+ documentation_uri: https://github.com/amkisko/sidekiq_status_monitor/blob/v1.2.0/README.md
210
224
  bug_tracker_uri: https://github.com/amkisko/sidekiq_status_monitor/issues
211
225
  post_install_message:
212
226
  rdoc_options: []
@@ -223,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
237
  - !ruby/object:Gem::Version
224
238
  version: '0'
225
239
  requirements: []
226
- rubygems_version: 3.4.19
240
+ rubygems_version: 3.5.9
227
241
  signing_key:
228
242
  specification_version: 4
229
243
  summary: Rack server that outputs HTTP JSON status of sidekiq instance for alive/liveness