lib/sidekiq/prometheus/exporter/standard.rb in sidekiq-prometheus-exporter-0.1.8 vs lib/sidekiq/prometheus/exporter/standard.rb in sidekiq-prometheus-exporter-0.1.9

- old
+ new

@@ -17,10 +17,11 @@ def initialize @overview_stats = Sidekiq::Stats.new @queues_stats = queues_stats @max_processing_times = max_processing_times + @total_workers = total_workers end def to_s TEMPLATE.result(binding).chomp! end @@ -40,9 +41,13 @@ .group_by { |execution| execution['queue'] } .each_with_object({}) do |(queue, executions), memo| oldest_execution = executions.min_by { |execution| execution['run_at'] } memo[queue] = now - oldest_execution['run_at'] end + end + + def total_workers + Sidekiq::ProcessSet.new.map { |process| process['concurrency'] }.reduce(:+) end end end end end