sidekiq-instrument 0.7.6 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e04a3fbc6feaded6cbf909b66e16eb962e6ae2d0e12d51d2c178ef46287cdfd2
4
- data.tar.gz: 686d408e2af636c68a33ca6ba167fa2cc2d2535b8260c03dab22e27490f92272
3
+ metadata.gz: ccfd8fdd3984b9ff42534a4ea1e50bce7b05132ec75d41c20fcc54d36d78466e
4
+ data.tar.gz: 11b9225cc839111dbb0d17dba77a702af15ea6b2da78665737de3f489cbc056d
5
5
  SHA512:
6
- metadata.gz: 3d31a5f01a1675ebdd2b49bcb0a1f97c28b73af87a8f83e5504ddceedd71c0bfac0030280f7e021bc0385639ce0106488c618e96e939391be919ba9e49a8f26f
7
- data.tar.gz: '09c03cb8c72f06fdaac5c7588b3deb747dbc40411a322728666daab1a795f11d0b24570f864ceabc5fc34e78601e3533483a5199ddfa02daef2e175214eed2ff'
6
+ metadata.gz: 2e093cbc306a13e36591f6328b946628f661e4e70df0e1ad5e03636ec378810ac830ef4e786b6088150c11f0940a9fb97e350ee3b1c33b7bcfcc93ceb62caf5d
7
+ data.tar.gz: 067fa12704008f8cc4719028959a8067581891aa6db9d1b050d60c0524fcee3dda571dc7d5f28b7b5bbd6a8c455c84329477faa5d7a4f573b1c41da550fd34f9
data/LICENSE.txt CHANGED
@@ -1,6 +1,4 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Matt Larraz
1
+ Copyright (c) 2025 Enova International
4
2
 
5
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +7,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
7
  copies of the Software, and to permit persons to whom the Software is
10
8
  furnished to do so, subject to the following conditions:
11
9
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
14
12
 
15
13
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
14
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
15
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
16
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
17
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.md CHANGED
@@ -170,7 +170,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/enova/
170
170
 
171
171
  ## License
172
172
 
173
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
173
+ The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
174
174
 
175
175
  [statsd-instrument]: https://github.com/Shopify/statsd-instrument
176
176
  [sidekiq-scheduler]: https://github.com/moove-it/sidekiq-scheduler
@@ -22,11 +22,11 @@ module Sidekiq::Instrument
22
22
  # - once when it is scheduled, with job['at'] key
23
23
  # - once when it is enqueued, without job['at'] key
24
24
  if job['at'].present?
25
- Statter.statsd.increment(metric_name(class_instance, 'schedule'))
25
+ Statter.statsd.increment(metric_name(class_instance, job, 'schedule'))
26
26
  Statter.dogstatsd&.increment('sidekiq.schedule', worker_dog_options(class_instance, job))
27
27
  else
28
28
  WorkerMetrics.trace_workers_increment_counter(klass.name.underscore)
29
- Statter.statsd.increment(metric_name(class_instance, 'enqueue'))
29
+ Statter.statsd.increment(metric_name(class_instance, job, 'enqueue'))
30
30
  Statter.dogstatsd&.increment('sidekiq.enqueue', worker_dog_options(class_instance, job))
31
31
  end
32
32
 
@@ -10,15 +10,15 @@ module Sidekiq::Instrument
10
10
  def call(worker, job, _queue, &block)
11
11
  dequeue_string = is_retry(job) ? 'dequeue.retry' : 'dequeue'
12
12
  Statter.dogstatsd&.increment("sidekiq.#{dequeue_string}", worker_dog_options(worker, job))
13
- Statter.statsd.increment(metric_name(worker, dequeue_string))
13
+ Statter.statsd.increment(metric_name(worker, job, 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
18
  Statter.dogstatsd&.timing('sidekiq.runtime', execution_time_ms, worker_dog_options(worker, job))
19
- Statter.statsd.measure(metric_name(worker, 'runtime'), execution_time_ms)
19
+ Statter.statsd.measure(metric_name(worker, job, 'runtime'), execution_time_ms)
20
20
  Statter.dogstatsd&.increment('sidekiq.success', worker_dog_options(worker, job))
21
- Statter.statsd.increment(metric_name(worker, 'success'))
21
+ Statter.statsd.increment(metric_name(worker, job, 'success'))
22
22
  rescue Exception => e
23
23
  dd_options = worker_dog_options(worker, job)
24
24
  dd_options[:tags] << "error:#{e.class.name}"
@@ -30,7 +30,7 @@ module Sidekiq::Instrument
30
30
  end
31
31
 
32
32
  Statter.dogstatsd&.increment('sidekiq.error', dd_options)
33
- Statter.statsd.increment(metric_name(worker, 'error'))
33
+ Statter.statsd.increment(metric_name(worker, job, 'error'))
34
34
 
35
35
  raise e
36
36
  ensure
@@ -1,17 +1,17 @@
1
1
  module Sidekiq::Instrument
2
2
  module MetricNames
3
- def metric_name(worker, event)
3
+ def metric_name(worker, job, event)
4
4
  if worker.respond_to?(:statsd_metric_name)
5
5
  worker.send(:statsd_metric_name, event)
6
6
  else
7
- "shared.sidekiq.#{queue_name(worker)}.#{class_name(worker)}.#{event}"
7
+ "shared.sidekiq.#{queue_name(job)}.#{class_name(worker)}.#{event}"
8
8
  end
9
9
  end
10
10
 
11
11
  def worker_dog_options(worker, job)
12
12
  {
13
13
  tags: [
14
- "queue:#{queue_name(worker)}",
14
+ "queue:#{queue_name(job)}",
15
15
  "worker:#{underscore(class_name(worker))}"
16
16
  ].concat(job.fetch('tags', []))
17
17
  }
@@ -31,8 +31,8 @@ module Sidekiq::Instrument
31
31
 
32
32
  private
33
33
 
34
- def queue_name(worker)
35
- worker.class.get_sidekiq_options['queue']
34
+ def queue_name(job)
35
+ job['queue']
36
36
  end
37
37
 
38
38
  def class_name(worker)
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Instrument
3
- VERSION = '0.7.6'
3
+ VERSION = '0.8.0'
4
4
  end
5
5
  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.7.6
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loan Application Services
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-21 00:00:00.000000000 Z
11
+ date: 2025-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -196,7 +196,7 @@ dependencies:
196
196
  - - ">="
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
- description:
199
+ description:
200
200
  email:
201
201
  - application_services@enova.com
202
202
  executables: []
@@ -227,7 +227,7 @@ homepage: https://github.com/enova/sidekiq-instrument
227
227
  licenses:
228
228
  - MIT
229
229
  metadata: {}
230
- post_install_message:
230
+ post_install_message:
231
231
  rdoc_options: []
232
232
  require_paths:
233
233
  - lib
@@ -242,8 +242,8 @@ 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.26
246
- signing_key:
245
+ rubygems_version: 3.0.3.1
246
+ signing_key:
247
247
  specification_version: 4
248
248
  summary: StatsD & DogStatsD Instrumentation for Sidekiq
249
249
  test_files: []