sidekiq-instrument 0.5.4 → 0.5.5

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: b4112a344ff91a81260af18c47e66fbd1806b9340f9bf0f632d84b405b308c39
4
- data.tar.gz: 8fddd4f0232f9c9a4b41ec29428e1a39a84c85dacdea09d1b60a0d535af4ff92
3
+ metadata.gz: f9a0f783ab0e59fc566b949266b79f362a76d7c99cd15886e5d09b01b26f08f0
4
+ data.tar.gz: b7d615af7a4884543ef3e7a5a585186fa0f93f1627fe9f5eac0576835b449136
5
5
  SHA512:
6
- metadata.gz: b75d3188a1b15368dc70d3f9fca27844f7a8c89dc52f7d632286c9e05268004c969f48ac37b5d11a9747c64342c74723e38873b0616782c8c19e082ba91531c9
7
- data.tar.gz: 5508859e81ef17cda16e7582f718f5e36b56ccc836895267927f96d997366340071e035f106252d6b0a9d336c013e451f82222284166b96ee0d26b170a149b9f
6
+ metadata.gz: 95343856da7a9cad0f41dbcfe4731a4837782ac13bf9f4b515579f45f4326b7f25e4d7c85c5e1ea7ef519f271cd1b6aa7f16c62c89e9c02acb412b1b321e57f8
7
+ data.tar.gz: dfd0394b47aba69c43e58feabd778dc38091f8e0e61a4c75086c23bf7504fcb294881f3102bbe4de8dbd85223ecf024bdc27721a615bfa6f46df298153a7c186
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Instrument
3
- VERSION = "0.5.4"
3
+ VERSION = '0.5.5'
4
4
  end
5
5
  end
@@ -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: nil,
12
+ processed: nil,
13
13
  workers_size: :workers,
14
- enqueued: :pending,
15
- failed: nil
14
+ enqueued: :pending,
15
+ failed: nil
16
16
  }
17
17
 
18
18
  def perform
@@ -29,17 +29,35 @@ module Sidekiq::Instrument
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: ["queue:#{queue.name}"])
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
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: 2023-01-17 00:00:00.000000000 Z
11
+ date: 2023-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq