lib/sidekiq/instrument/middleware/server.rb in sidekiq-instrument-0.5.5 vs lib/sidekiq/instrument/middleware/server.rb in sidekiq-instrument-0.5.6

- old
+ new

@@ -1,16 +1,20 @@ +# frozen_string_literal: true + require 'sidekiq/instrument/mixin' +require 'active_support/core_ext/string/inflections' module Sidekiq::Instrument class ServerMiddleware include Sidekiq::Instrument::MetricNames def call(worker, job, queue, &block) Statter.statsd.increment(metric_name(worker, 'dequeue')) Statter.dogstatsd&.increment('sidekiq.dequeue', worker_dog_options(worker)) start_time = Time.now + WorkerMetrics.trace_workers_decrement_counter(worker.class.to_s.underscore) yield block execution_time_ms = (Time.now - start_time) * 1000 Statter.statsd.measure(metric_name(worker, 'runtime'), execution_time_ms) Statter.dogstatsd&.timing('sidekiq.runtime', execution_time_ms, worker_dog_options(worker)) rescue StandardError => e @@ -20,6 +24,5 @@ ensure Statter.dogstatsd&.flush(sync: true) end end end -