sidekiq-instrument 0.7.1 → 0.7.3

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: db865235fec8b38f0539955fcea78d64af8bdd18652d5f8ddf9f6e184279d2a8
4
- data.tar.gz: 76b9633e492b0831927f8c07d22f8901e396ac11023013c92611652c8d7bfc5c
3
+ metadata.gz: 7c79cacef1cb058038cfd3c55495349dbbd4b4c023114bb4760e83868647a9b1
4
+ data.tar.gz: c2c1ad52812042a210fc7549b48520977ec33836b850b17110002d3b23d442d4
5
5
  SHA512:
6
- metadata.gz: 53adc64be56592453878813e397a618070181df863bfd2f61f6e2b3e239a2e4705a3662c3051acfd5dd72621d71c63cef1c296cbbb82d1dc5a3e11c7f29a41bc
7
- data.tar.gz: 5fc9b80770108d223784cac1b16e381764d9b53afb4f1aa6250673cdcf83ea2c143b5a408ad836bd0df712064badf910cdaf00d7e0a27bf247c7df054a621b02
6
+ metadata.gz: c586597549a8eb0a7002ea2f1b290737a39d5fb08f66565f613c5f77448c32027f961b44a3c2cd743f05f80f0bdaf3e4fcc8297357e8b3f6eb43bd3b25d0c14a
7
+ data.tar.gz: 88d1aee1549d0189be4c6e71cefdb6dc7d975f932c9e47b20ce7b9245646f2eb01d29e2b079e300197afa028888c9e26c2e5eefbebed4fdf8d20013170667fb4
@@ -20,7 +20,7 @@ module Sidekiq::Instrument
20
20
  if Sidekiq::Context.current[:class].present?
21
21
  WorkerMetrics.trace_workers_increment_counter(klass.name.underscore)
22
22
  Statter.statsd.increment(metric_name(class_instance, 'enqueue'))
23
- Statter.dogstatsd&.increment('sidekiq.enqueue', worker_dog_options(class_instance))
23
+ Statter.dogstatsd&.increment('sidekiq.enqueue', worker_dog_options(class_instance, job))
24
24
  end
25
25
 
26
26
  Statter.dogstatsd&.flush(sync: true)
@@ -9,23 +9,27 @@ module Sidekiq::Instrument
9
9
 
10
10
  def call(worker, job, _queue, &block)
11
11
  dequeue_string = is_retry(job) ? 'dequeue.retry' : 'dequeue'
12
- Statter.dogstatsd&.increment("sidekiq.#{dequeue_string}", worker_dog_options(worker))
12
+ Statter.dogstatsd&.increment("sidekiq.#{dequeue_string}", worker_dog_options(worker, job))
13
13
  Statter.statsd.increment(metric_name(worker, 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
+ Statter.dogstatsd&.timing('sidekiq.runtime', execution_time_ms, worker_dog_options(worker, job))
18
19
  Statter.statsd.measure(metric_name(worker, 'runtime'), execution_time_ms)
19
- Statter.dogstatsd&.timing('sidekiq.runtime', execution_time_ms, worker_dog_options(worker))
20
- rescue StandardError => e
20
+ rescue Exception => e
21
+ dd_options = worker_dog_options(worker, job)
22
+ dd_options[:tags] << "error:#{e.class.name}"
23
+
21
24
  # if we have retries left, increment the enqueue.retry counter to indicate the job is going back on the queue
22
25
  if max_retries(worker) > current_retries(job) + 1
23
26
  WorkerMetrics.trace_workers_increment_counter(worker.class.to_s.underscore)
24
- Statter.dogstatsd&.increment('sidekiq.enqueue.retry', worker_dog_options(worker))
27
+ Statter.dogstatsd&.increment('sidekiq.enqueue.retry', dd_options)
25
28
  end
26
29
 
30
+ Statter.dogstatsd&.increment('sidekiq.error', dd_options)
27
31
  Statter.statsd.increment(metric_name(worker, 'error'))
28
- Statter.dogstatsd&.increment('sidekiq.error', worker_dog_options(worker))
32
+
29
33
  raise e
30
34
  ensure
31
35
  WorkerMetrics.trace_workers_decrement_counter(worker.class.to_s.underscore)
@@ -8,8 +8,13 @@ module Sidekiq::Instrument
8
8
  end
9
9
  end
10
10
 
11
- def worker_dog_options(worker)
12
- { tags: ["queue:#{queue_name(worker)}", "worker:#{underscore(class_name(worker))}"] }
11
+ def worker_dog_options(worker, job)
12
+ {
13
+ tags: [
14
+ "queue:#{queue_name(worker)}",
15
+ "worker:#{underscore(class_name(worker))}"
16
+ ].concat(job.fetch('tags', []))
17
+ }
13
18
  end
14
19
 
15
20
  def max_retries(worker)
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Instrument
3
- VERSION = '0.7.1'
3
+ VERSION = '0.7.3'
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.1
4
+ version: 0.7.3
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-09-05 00:00:00.000000000 Z
11
+ date: 2024-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq