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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06c38373f208fd6ec2ed7d3ab01f8cd763d71cc5c44a1684eeaebc824eed489d
4
- data.tar.gz: 5207e4868b8190e4a1501977a1736265c501b179fdb66bc0945da9128f3aff66
3
+ metadata.gz: 5ba4e03d629681c781677f3c5341dca1092adb402ca7164d2da5ef04c8114fe4
4
+ data.tar.gz: dbc5292dca650333a15cf309537876ef3862aa772f7741e215cf60daa0c429be
5
5
  SHA512:
6
- metadata.gz: '0380968a8a88a122fea11c487126ce03094a02db41749c663966a2317aa0892a96fd966d373160477a9855e52421bb7d7c2892dcc42ea78f27ed1a7c42704fd1'
7
- data.tar.gz: a89416da29a199afdb5930a62ad2bb479bdccac9b4a4af378094e53d3139d41a867f0af69920a03096d43e7ed7f2e6d9145c70c9a1fc4a34e9836506dcfa0656
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.inqueue.#{key}**: number of jobs "in queue" per worker, uses redis to track increment/decrement
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.inqueue.#{key}**: number of jobs "in queue" per worker, uses redis to track increment/decrement
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, job, queue, &block)
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,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Instrument
3
- VERSION = '0.6.0'
3
+ VERSION = '0.6.2'
4
4
  end
5
5
  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.inqueue.#{key}", value)
68
- Statter.dogstatsd&.gauge("shared.sidekiq.worker_metrics.inqueue.#{key}", value)
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
@@ -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.0
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-05-10 00:00:00.000000000 Z
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.0.3
245
+ rubygems_version: 3.1.6
232
246
  signing_key:
233
247
  specification_version: 4
234
248
  summary: StatsD & DogStatsD Instrumentation for Sidekiq