sidekiq-instrument 0.7.3 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -10
- data/lib/sidekiq/instrument/middleware/client.rb +12 -6
- data/lib/sidekiq/instrument/middleware/server.rb +2 -0
- data/lib/sidekiq/instrument/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80c86d5df7ca90b39edcb4c60ca4a92e1c1e128584bbc78be60f4dd6f75b3d19
|
4
|
+
data.tar.gz: 5e6807e9553c968e8ddb61f1cc7061e8798d4e1aca6257ebab86eb29bfd5f3d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dca33f186fe4ca74db99a2fe8836047a5bfd499f435c28ebd20601835e43553cabb5565713ea17c2d7e08a5e68bb516622033674dfe5ef96496c8ff56b07ee79
|
7
|
+
data.tar.gz: b41c82a0b3d99eaea85fcbf00bcd631a04dc69edd152a849066866dc132ded2ceb9514277f5842fe33944c0c0141016672ab2fca20d26de5130e3d7f56c22e45
|
data/README.md
CHANGED
@@ -75,16 +75,19 @@ 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_.success**: counter incremented each time a job succeeds.
|
85
|
+
5. **shared.sidekiq._queue_._job_.runtime**: timer of the total time spent
|
83
86
|
in `perform`, in milliseconds.
|
84
|
-
|
87
|
+
6. **shared.sidekiq._queue_._job_.error**: counter incremented each time a
|
85
88
|
job fails.
|
86
89
|
|
87
|
-
For job retry attempts,
|
90
|
+
For job retry attempts, metrics 2-5 will still be reported but the enqueue/dequeue metrics
|
88
91
|
will have a `.retry` appended:
|
89
92
|
|
90
93
|
1. **shared.sidekiq._queue_._job_.enqueue.retry**
|
@@ -103,13 +106,16 @@ For each worker, the following metrics and tags will be reported:
|
|
103
106
|
## DogStatsD Keys
|
104
107
|
For each job, the following metrics and tags will be reported:
|
105
108
|
|
106
|
-
1. **sidekiq.
|
109
|
+
1. **sidekiq.schedule (tags: {queue: _queue_, worker: _job_})**: counter incremented each time a
|
110
|
+
job is scheduled to be pushed onto the queue later.
|
111
|
+
2. **sidekiq.enqueue (tags: {queue: _queue_, worker: _job_})**: counter incremented each time a
|
107
112
|
job is pushed onto the queue.
|
108
|
-
|
113
|
+
3. **sidekiq.dequeue (tags: {queue: _queue_, worker: _job_})**: counter incremented just before
|
109
114
|
worker begins performing a job.
|
110
|
-
|
115
|
+
4. **sidekiq.success (tags: {queue: _queue_, worker: _job_})**: counter incremented each time a job succeeds.
|
116
|
+
5. **sidekiq.runtime (tags: {queue: _queue_, worker: _job_})**: timer of the total time spent
|
111
117
|
in `perform`, in milliseconds.
|
112
|
-
|
118
|
+
6. **sidekiq.error (tags: {queue: _queue_, worker: _job_, error: _errorclass_})**: counter incremented each time a
|
113
119
|
job fails.
|
114
120
|
|
115
121
|
For job retry attempts, the above 4 metrics will still be reported but the enqueue/dequeue metrics
|
@@ -127,7 +133,7 @@ For each worker, the following metrics and tags will be reported:
|
|
127
133
|
|
128
134
|
## Worker
|
129
135
|
|
130
|
-
**WARNING: The metrics reported by this Worker are currently inaccurate.**
|
136
|
+
**WARNING: The Redis count metrics reported by this Worker are currently inaccurate.**
|
131
137
|
|
132
138
|
There is a worker, `Sidekiq::Instrument::Worker`, that submits gauges
|
133
139
|
for various interesting statistics; namely, the bulk of the information in `Sidekiq::Stats`
|
@@ -12,12 +12,18 @@ 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
29
|
Statter.dogstatsd&.increment('sidekiq.enqueue', worker_dog_options(class_instance, job))
|
@@ -17,6 +17,8 @@ module Sidekiq::Instrument
|
|
17
17
|
execution_time_ms = (Time.now - start_time) * 1000
|
18
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
|
+
Statter.dogstatsd&.increment('sidekiq.success', worker_dog_options(worker, job))
|
21
|
+
Statter.statsd.increment(metric_name(worker, 'success'))
|
20
22
|
rescue Exception => e
|
21
23
|
dd_options = worker_dog_options(worker, job)
|
22
24
|
dd_options[:tags] << "error:#{e.class.name}"
|
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.5
|
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-
|
11
|
+
date: 2024-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|