lib/sidekiq/middleware/server/datadog.rb in sidekiq-datadog-0.3.0 vs lib/sidekiq/middleware/server/datadog.rb in sidekiq-datadog-0.3.1

- old
+ new

@@ -55,10 +55,13 @@ private def record(worker, job, queue, start, error = nil) ms = ((Time.now - start) * 1000).round + if job["created_at"] + queued_ms = start - Time.at(job["created_at"]) + end name = underscore(job['wrapped'] || worker.class.to_s) tags = @tags.map do |tag| case tag when String then tag when Proc then tag.call(worker, job, queue, error) end end @@ -72,9 +75,12 @@ end tags.compact! @statsd.increment @metric_name, :tags => tags @statsd.timing "#{@metric_name}.time", ms, :tags => tags + if queued_ms + @statsd.timing "#{@metric_name}.queued_time", queued_ms, :tags => tags + end end def underscore(word) word = word.to_s.gsub(/::/, '/') word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')