Module: Sidekiq::Instrument::MetricNames
- Included in:
- ClientMiddleware, ServerMiddleware
- Defined in:
- lib/sidekiq/instrument/mixin.rb
Instance Method Summary collapse
- #max_retries(worker) ⇒ Object
- #metric_name(worker, event) ⇒ Object
- #worker_dog_options(worker, job) ⇒ Object
Instance Method Details
#max_retries(worker) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sidekiq/instrument/mixin.rb', line 20 def max_retries(worker) retries = fetch_worker_retry(worker) case retries.to_s when "true", "" Sidekiq[:max_retries] when "false" 0 else retries end end |
#metric_name(worker, event) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/sidekiq/instrument/mixin.rb', line 3 def metric_name(worker, event) if worker.respond_to?(:statsd_metric_name) worker.send(:statsd_metric_name, event) else "shared.sidekiq.#{queue_name(worker)}.#{class_name(worker)}.#{event}" end end |
#worker_dog_options(worker, job) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/sidekiq/instrument/mixin.rb', line 11 def (worker, job) { tags: [ "queue:#{queue_name(worker)}", "worker:#{underscore(class_name(worker))}" ].concat(job.fetch('tags', [])) } end |