sidekiq-instrument 0.7.2 → 0.7.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c29103ed3ffc948efe59b49ff4df569bf52a6ced1a953ea9ada47a251b2a2d63
|
4
|
+
data.tar.gz: 1da9a28a99b77c92699a1cbbdccaf2cc7cd95d11a925d2099858ad5ffa616444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e28f76f957396f1fa28fbe3f0ca737da2443b5bc70487d0389944454dce6720213257eae502c58b056640ad58388d0787c14eb2b5405217aa97766a7c5cb7a0f
|
7
|
+
data.tar.gz: f99843e887127800d81453e4d569b676ed0a67091d5636d078fc39367bf827d459a1dca21e75d6171cec98799825f72b403ed0358f90dfbda80abcbe6060a7be
|
data/README.md
CHANGED
@@ -75,16 +75,18 @@ Sidekiq::Instrument::WorkerMetrics.namespace = <APP_NAME>
|
|
75
75
|
## StatsD Keys
|
76
76
|
For each job, the following metrics will be reported:
|
77
77
|
|
78
|
-
1. **shared.sidekiq._queue_._job_.
|
78
|
+
1. **shared.sidekiq._queue_._job_.schedule**: counter incremented each time a
|
79
|
+
job is scheduled to be pushed onto the queue later.
|
80
|
+
2. **shared.sidekiq._queue_._job_.enqueue**: counter incremented each time a
|
79
81
|
job is pushed onto the queue.
|
80
|
-
|
82
|
+
3. **shared.sidekiq._queue_._job_.dequeue**: counter incremented just before
|
81
83
|
worker begins performing a job.
|
82
|
-
|
84
|
+
4. **shared.sidekiq._queue_._job_.runtime**: timer of the total time spent
|
83
85
|
in `perform`, in milliseconds.
|
84
|
-
|
86
|
+
5. **shared.sidekiq._queue_._job_.error**: counter incremented each time a
|
85
87
|
job fails.
|
86
88
|
|
87
|
-
For job retry attempts,
|
89
|
+
For job retry attempts, metrics 2-5 will still be reported but the enqueue/dequeue metrics
|
88
90
|
will have a `.retry` appended:
|
89
91
|
|
90
92
|
1. **shared.sidekiq._queue_._job_.enqueue.retry**
|
@@ -103,13 +105,15 @@ For each worker, the following metrics and tags will be reported:
|
|
103
105
|
## DogStatsD Keys
|
104
106
|
For each job, the following metrics and tags will be reported:
|
105
107
|
|
106
|
-
1. **sidekiq.
|
108
|
+
1. **sidekiq.schedule (tags: {queue: _queue_, worker: _job_})**: counter incremented each time a
|
109
|
+
job is scheduled to be pushed onto the queue later.
|
110
|
+
2. **sidekiq.enqueue (tags: {queue: _queue_, worker: _job_})**: counter incremented each time a
|
107
111
|
job is pushed onto the queue.
|
108
|
-
|
112
|
+
3. **sidekiq.dequeue (tags: {queue: _queue_, worker: _job_})**: counter incremented just before
|
109
113
|
worker begins performing a job.
|
110
|
-
|
114
|
+
4. **sidekiq.runtime (tags: {queue: _queue_, worker: _job_})**: timer of the total time spent
|
111
115
|
in `perform`, in milliseconds.
|
112
|
-
|
116
|
+
5. **sidekiq.error (tags: {queue: _queue_, worker: _job_, error: _errorclass_})**: counter incremented each time a
|
113
117
|
job fails.
|
114
118
|
|
115
119
|
For job retry attempts, the above 4 metrics will still be reported but the enqueue/dequeue metrics
|
@@ -127,7 +131,7 @@ For each worker, the following metrics and tags will be reported:
|
|
127
131
|
|
128
132
|
## Worker
|
129
133
|
|
130
|
-
**WARNING: The metrics reported by this Worker are currently inaccurate.**
|
134
|
+
**WARNING: The Redis count metrics reported by this Worker are currently inaccurate.**
|
131
135
|
|
132
136
|
There is a worker, `Sidekiq::Instrument::Worker`, that submits gauges
|
133
137
|
for various interesting statistics; namely, the bulk of the information in `Sidekiq::Stats`
|
@@ -12,15 +12,21 @@ module Sidekiq::Instrument
|
|
12
12
|
klass = Object.const_get(worker_class.to_s)
|
13
13
|
class_instance = klass.new
|
14
14
|
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
|
15
|
+
# Depending on the type of perform called, this method can be hit either
|
16
|
+
# once or twice for the same Job ID.
|
17
|
+
#
|
18
|
+
# perform_async:
|
19
|
+
# - once when it is enqueued, with no job['at'] key
|
20
|
+
# perform_in:
|
21
|
+
# - once when it is scheduled, with job['at'] key
|
22
|
+
# - once when it is enqueued, without job['at'] key
|
23
|
+
if job['at'].present?
|
24
|
+
Statter.statsd.increment(metric_name(class_instance, 'schedule'))
|
25
|
+
Statter.dogstatsd&.increment('sidekiq.schedule', worker_dog_options(class_instance, job))
|
26
|
+
else
|
21
27
|
WorkerMetrics.trace_workers_increment_counter(klass.name.underscore)
|
22
28
|
Statter.statsd.increment(metric_name(class_instance, 'enqueue'))
|
23
|
-
Statter.dogstatsd&.increment('sidekiq.enqueue', worker_dog_options(class_instance))
|
29
|
+
Statter.dogstatsd&.increment('sidekiq.enqueue', worker_dog_options(class_instance, job))
|
24
30
|
end
|
25
31
|
|
26
32
|
Statter.dogstatsd&.flush(sync: true)
|
@@ -9,16 +9,16 @@ module Sidekiq::Instrument
|
|
9
9
|
|
10
10
|
def call(worker, job, _queue, &block)
|
11
11
|
dequeue_string = is_retry(job) ? 'dequeue.retry' : 'dequeue'
|
12
|
-
Statter.dogstatsd&.increment("sidekiq.#{dequeue_string}", worker_dog_options(worker))
|
12
|
+
Statter.dogstatsd&.increment("sidekiq.#{dequeue_string}", worker_dog_options(worker, job))
|
13
13
|
Statter.statsd.increment(metric_name(worker, dequeue_string))
|
14
14
|
|
15
15
|
start_time = Time.now
|
16
16
|
yield block
|
17
17
|
execution_time_ms = (Time.now - start_time) * 1000
|
18
|
-
Statter.dogstatsd&.timing('sidekiq.runtime', execution_time_ms, worker_dog_options(worker))
|
18
|
+
Statter.dogstatsd&.timing('sidekiq.runtime', execution_time_ms, worker_dog_options(worker, job))
|
19
19
|
Statter.statsd.measure(metric_name(worker, 'runtime'), execution_time_ms)
|
20
20
|
rescue Exception => e
|
21
|
-
dd_options = worker_dog_options(worker)
|
21
|
+
dd_options = worker_dog_options(worker, job)
|
22
22
|
dd_options[:tags] << "error:#{e.class.name}"
|
23
23
|
|
24
24
|
# if we have retries left, increment the enqueue.retry counter to indicate the job is going back on the queue
|
@@ -8,8 +8,13 @@ module Sidekiq::Instrument
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def worker_dog_options(worker)
|
12
|
-
{
|
11
|
+
def worker_dog_options(worker, job)
|
12
|
+
{
|
13
|
+
tags: [
|
14
|
+
"queue:#{queue_name(worker)}",
|
15
|
+
"worker:#{underscore(class_name(worker))}"
|
16
|
+
].concat(job.fetch('tags', []))
|
17
|
+
}
|
13
18
|
end
|
14
19
|
|
15
20
|
def max_retries(worker)
|
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.7.
|
4
|
+
version: 0.7.4
|
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: 2024-09-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
242
|
- !ruby/object:Gem::Version
|
243
243
|
version: '0'
|
244
244
|
requirements: []
|
245
|
-
rubygems_version: 3.3.
|
245
|
+
rubygems_version: 3.3.7
|
246
246
|
signing_key:
|
247
247
|
specification_version: 4
|
248
248
|
summary: StatsD & DogStatsD Instrumentation for Sidekiq
|