Skip to content
Permalink
Browse files

FIX: correct metrics so they are host not per cluster

per host metrics are far more powerful, especially once deployed
across multiple machines
  • Loading branch information
SamSaffron committed Feb 14, 2020
1 parent ace70d3 commit e2b144e21a5767cd6553f6c1ab52aa2b58b0ff54
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/internal_metric/global.rb
@@ -80,14 +80,20 @@ def collect
stats
end

# not correct, should be per machine
@sidekiq_workers = Sidekiq::ProcessSet.new.sum { |p| p["concurrency"] }
@sidekiq_processes = 0
@sidekiq_workers = Sidekiq::ProcessSet.new.sum do |process|
if process["hostname"] == Global.hostname
@sidekiq_processes += 1
process["concurrency"]
else
0
end
end

@sidekiq_stuck_workers = Sidekiq::Workers.new.filter do |queue, _, w|
queue.start_with?(Global.hostname) && Time.at(w["run_at"]) < (Time.now - 60 * STUCK_JOB_MINUTES)
end.count

@sidekiq_processes = (Sidekiq::ProcessSet.new.size || 0) rescue 0
@sidekiq_paused = sidekiq_paused_states

@missing_s3_uploads = missing_uploads("s3")

0 comments on commit e2b144e

Please sign in to comment.
You can’t perform that action at this time.