class Sidekiq::Instrument::Worker

Constants

METRIC_NAMES

These defaults are for compatibility with Resque's stats names (i.e. the metrics will reported as :processed, :workers, :pending, and :failed). Feel free to override.

Public Instance Methods

perform() click to toggle source
# File lib/sidekiq/instrument/worker.rb, line 18
def perform
  info = Sidekiq::Stats.new

  self.class::METRIC_NAMES.each do |method, stat|
    stat ||= method

    StatsD.gauge "shared.sidekiq.stats.#{stat}", info.send(method)
  end

  working = Sidekiq::ProcessSet.new.select { |p| p[:busy] == 1 }.count
  StatsD.gauge "shared.sidekiq.stats.working", working

  info.queues.each do |name, size|
    StatsD.gauge "shared.sidekiq.#{name}.size", size
  end
end