sidekiq-instrument 0.5.3 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sidekiq/instrument/version.rb +1 -1
- data/lib/sidekiq/instrument/worker.rb +28 -10
- 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: f9a0f783ab0e59fc566b949266b79f362a76d7c99cd15886e5d09b01b26f08f0
|
4
|
+
data.tar.gz: b7d615af7a4884543ef3e7a5a585186fa0f93f1627fe9f5eac0576835b449136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95343856da7a9cad0f41dbcfe4731a4837782ac13bf9f4b515579f45f4326b7f25e4d7c85c5e1ea7ef519f271cd1b6aa7f16c62c89e9c02acb412b1b321e57f8
|
7
|
+
data.tar.gz: dfd0394b47aba69c43e58feabd778dc38091f8e0e61a4c75086c23bf7504fcb294881f3102bbe4de8dbd85223ecf024bdc27721a615bfa6f46df298153a7c186
|
@@ -9,10 +9,10 @@ module Sidekiq::Instrument
|
|
9
9
|
# (i.e. the metrics will reported as :processed, :workers, :pending, and :failed).
|
10
10
|
# Feel free to override.
|
11
11
|
METRIC_NAMES = {
|
12
|
-
processed:
|
12
|
+
processed: nil,
|
13
13
|
workers_size: :workers,
|
14
|
-
enqueued:
|
15
|
-
failed:
|
14
|
+
enqueued: :pending,
|
15
|
+
failed: nil
|
16
16
|
}
|
17
17
|
|
18
18
|
def perform
|
@@ -25,21 +25,39 @@ module Sidekiq::Instrument
|
|
25
25
|
Statter.dogstatsd&.gauge("sidekiq.#{stat}", info.send(method))
|
26
26
|
end
|
27
27
|
|
28
|
-
working = Sidekiq::
|
28
|
+
working = Sidekiq::Workers.new.count
|
29
29
|
Statter.statsd.gauge('shared.sidekiq.stats.working', working)
|
30
30
|
Statter.dogstatsd&.gauge('sidekiq.working', working)
|
31
31
|
|
32
|
-
info.queues.each do |name, size|
|
33
|
-
Statter.statsd.gauge("shared.sidekiq.#{name}.size", size)
|
34
|
-
Statter.dogstatsd&.gauge('sidekiq.queue.size', size, tags: ["queue:#{name}"])
|
35
|
-
end
|
36
|
-
|
37
32
|
Sidekiq::Queue.all.each do |queue|
|
33
|
+
Statter.statsd.gauge("shared.sidekiq.#{queue.name}.size", queue.size)
|
34
|
+
Statter.dogstatsd&.gauge('sidekiq.queue.size', queue.size, tags: dd_tags(queue))
|
35
|
+
|
38
36
|
Statter.statsd.gauge("shared.sidekiq.#{queue.name}.latency", queue.latency)
|
39
|
-
Statter.dogstatsd&.gauge('sidekiq.queue.latency', queue.latency, tags:
|
37
|
+
Statter.dogstatsd&.gauge('sidekiq.queue.latency', queue.latency, tags: dd_tags(queue))
|
40
38
|
end
|
41
39
|
|
42
40
|
Statter.dogstatsd&.flush(sync: true)
|
43
41
|
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
# @param [Sidekiq::Queue] queue used for stats emission
|
46
|
+
# @return [Array<String>] an array of tags
|
47
|
+
# @example this method can be override to add more tags
|
48
|
+
# class MyStatsWorker < Sidekiq::Instrument::Worker
|
49
|
+
# private
|
50
|
+
#
|
51
|
+
# def dd_tags(queue)
|
52
|
+
# custom_tags = []
|
53
|
+
# queue_type = queue.name.match?(/readonly$/) ? 'read_only' : 'regular'
|
54
|
+
# custom_tags << "queue_type:#{queue_type}"
|
55
|
+
#
|
56
|
+
# super(queue) | custom_tags
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
def dd_tags(queue)
|
60
|
+
["queue:#{queue.name}"]
|
61
|
+
end
|
44
62
|
end
|
45
63
|
end
|
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.5.
|
4
|
+
version: 0.5.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:
|
11
|
+
date: 2023-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|