Class: Amigo::Autoscaler::Checkers::Sidekiq
- Inherits:
-
Amigo::Autoscaler::Checker
- Object
- Amigo::Autoscaler::Checker
- Amigo::Autoscaler::Checkers::Sidekiq
- Defined in:
- lib/amigo/autoscaler/checkers/sidekiq.rb
Instance Method Summary collapse
Instance Method Details
#get_latencies ⇒ Object
11 12 13 14 15 |
# File 'lib/amigo/autoscaler/checkers/sidekiq.rb', line 11 def get_latencies return ::Sidekiq::Queue.all. map { |q| [q.name, q.latency] }. to_h end |
#get_pool_usage ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/amigo/autoscaler/checkers/sidekiq.rb', line 17 def get_pool_usage ps = ::Sidekiq::ProcessSet.new total_concurrency = 0 total_busy = 0 ps.each do |process| total_concurrency += process["concurrency"] || 0 total_busy += process["busy"] || 0 end return 0.0 if total_concurrency.zero? return total_busy.to_f / total_concurrency end |