Class: SidekiqVigil::Check::Utilization

Inherits:
Base
  • Object
show all
Defined in:
lib/sidekiq_vigil/check/utilization.rb

Constant Summary collapse

STATE_TTL_PADDING =
300

Instance Attribute Summary

Attributes inherited from Base

#api, #clock, #logger, #options, #storage

Instance Method Summary collapse

Methods inherited from Base

#check_name, #execute, #initialize

Constructor Details

This class inherits a constructor from SidekiqVigil::Check::Base

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sidekiq_vigil/check/utilization.rb', line 8

def call
  busy, concurrency = totals
  ratio = concurrency.zero? ? 0.0 : busy.fdiv(concurrency)
  severity, threshold = sustained_severity(ratio)
  Result.new(
    check_name:,
    severity:,
    value: ratio,
    threshold:,
    message: format(
      "%<ratio>.1f%% utilized (%<busy>d/%<concurrency>d)",
      ratio: ratio * 100,
      busy:,
      concurrency:
    )
  )
end