sidekiq-instrument 0.6.0 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/sidekiq/instrument/middleware/server.rb +2 -2
- data/lib/sidekiq/instrument/version.rb +1 -1
- data/lib/sidekiq/instrument/worker.rb +5 -3
- data/sidekiq-instrument.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ba4e03d629681c781677f3c5341dca1092adb402ca7164d2da5ef04c8114fe4
|
4
|
+
data.tar.gz: dbc5292dca650333a15cf309537876ef3862aa772f7741e215cf60daa0c429be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45ab4c7fbfa1cbb84b0bc09fcd7bd582238e8d6e57a3670de78d5c6213687b1619af1a8ad114853dccbf5633235fe8fc86dfe9755839de62e4939eca2766ccf9
|
7
|
+
data.tar.gz: 5b2f9fdbdac1d6128fb4fdef2e7da3f17be2b665721d968f7efd7feb4e54448bfbc43e7d31251f9f051a64fd721c8538df05f2731d69f1b9a10d94b4282227ed
|
data/README.md
CHANGED
@@ -92,7 +92,7 @@ For each queue, the following metrics will be reported:
|
|
92
92
|
2. **shared.sidekiq._queue_.latency**: gauge of how long the oldest job has been in the queue
|
93
93
|
|
94
94
|
For each worker, the following metrics and tags will be reported:
|
95
|
-
1. **sidekiq.worker_metrics.
|
95
|
+
1. **sidekiq.worker_metrics.in_queue.#{key}**: number of jobs "in queue" per worker, uses redis to track increment/decrement
|
96
96
|
|
97
97
|
## DogStatsD Keys
|
98
98
|
For each job, the following metrics and tags will be reported:
|
@@ -111,7 +111,7 @@ For each queue, the following metrics and tags will be reported:
|
|
111
111
|
2. **sidekiq.queue.latency (tags: {queue: _queue_})**: gauge of how long the oldest job has been in the queue
|
112
112
|
|
113
113
|
For each worker, the following metrics and tags will be reported:
|
114
|
-
1. **sidekiq.worker_metrics.
|
114
|
+
1. **sidekiq.worker_metrics.in_queue.#{key}**: number of jobs "in queue" per worker, uses redis to track increment/decrement
|
115
115
|
|
116
116
|
## Worker
|
117
117
|
There is a worker, `Sidekiq::Instrument::Worker`, that submits gauges
|
@@ -7,12 +7,11 @@ module Sidekiq::Instrument
|
|
7
7
|
class ServerMiddleware
|
8
8
|
include Sidekiq::Instrument::MetricNames
|
9
9
|
|
10
|
-
def call(worker,
|
10
|
+
def call(worker, _job, _queue, &block)
|
11
11
|
Statter.statsd.increment(metric_name(worker, 'dequeue'))
|
12
12
|
Statter.dogstatsd&.increment('sidekiq.dequeue', worker_dog_options(worker))
|
13
13
|
|
14
14
|
start_time = Time.now
|
15
|
-
WorkerMetrics.trace_workers_decrement_counter(worker.class.to_s.underscore)
|
16
15
|
yield block
|
17
16
|
execution_time_ms = (Time.now - start_time) * 1000
|
18
17
|
Statter.statsd.measure(metric_name(worker, 'runtime'), execution_time_ms)
|
@@ -22,6 +21,7 @@ module Sidekiq::Instrument
|
|
22
21
|
Statter.dogstatsd&.increment('sidekiq.error', worker_dog_options(worker))
|
23
22
|
raise e
|
24
23
|
ensure
|
24
|
+
WorkerMetrics.trace_workers_decrement_counter(worker.class.to_s.underscore)
|
25
25
|
Statter.dogstatsd&.flush(sync: true)
|
26
26
|
end
|
27
27
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'sidekiq'
|
2
4
|
require 'sidekiq/api'
|
3
5
|
|
@@ -13,7 +15,7 @@ module Sidekiq::Instrument
|
|
13
15
|
workers_size: :workers,
|
14
16
|
enqueued: :pending,
|
15
17
|
failed: nil
|
16
|
-
}
|
18
|
+
}.freeze
|
17
19
|
|
18
20
|
def perform
|
19
21
|
info = Sidekiq::Stats.new
|
@@ -64,8 +66,8 @@ module Sidekiq::Instrument
|
|
64
66
|
return unless WorkerMetrics.enabled
|
65
67
|
|
66
68
|
WorkerMetrics.workers_in_queue.each do |key, value|
|
67
|
-
Statter.statsd.gauge("shared.sidekiq.worker_metrics.
|
68
|
-
Statter.dogstatsd&.gauge(
|
69
|
+
Statter.statsd.gauge("shared.sidekiq.worker_metrics.in_queue.#{key}", value)
|
70
|
+
Statter.dogstatsd&.gauge('shared.sidekiq.worker_metrics.in_queue', value, tags: ["worker:#{key}"])
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
data/sidekiq-instrument.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 2.0', '>= 2.0.2'
|
26
26
|
spec.add_development_dependency 'rake', '~> 12.0'
|
27
27
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 1.0'
|
28
29
|
spec.add_development_dependency 'pry-byebug', '~> 3.4'
|
29
30
|
spec.add_development_dependency 'simplecov'
|
30
31
|
spec.add_development_dependency 'simplecov-cobertura'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-instrument
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loan Application Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -140,6 +140,20 @@ dependencies:
|
|
140
140
|
- - "~>"
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '3.0'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: rubocop
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '1.0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - "~>"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '1.0'
|
143
157
|
- !ruby/object:Gem::Dependency
|
144
158
|
name: pry-byebug
|
145
159
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
242
|
- !ruby/object:Gem::Version
|
229
243
|
version: '0'
|
230
244
|
requirements: []
|
231
|
-
rubygems_version: 3.
|
245
|
+
rubygems_version: 3.1.6
|
232
246
|
signing_key:
|
233
247
|
specification_version: 4
|
234
248
|
summary: StatsD & DogStatsD Instrumentation for Sidekiq
|