Class: Salus::Absolute
Constant Summary
Constants inherited from Metric
Instance Method Summary collapse
Methods inherited from Metric
#clear, descendants, #expired?, inherited, #initialize, #load, #mute?, #push, #save, #timestamp, #to_h, #ttl, #value
Methods included from Lockable
#broadcast, #signal, #synchronize, #wait, #wait_until
Methods included from Logging
Constructor Details
This class inherits a constructor from Salus::Metric
Instance Method Details
#calc ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/salus/metric/absolute.rb', line 3 def calc super @last_calced_value = nil if @values.length < STORAGE_DEPTH return elsif @values[0].expired?(@values[1].) return elsif !@values[1].value.is_a?(Numeric) return end @last_calced_value = begin dt = (@values[1]. - @values[0].) (dt == 0) ? nil : (@values[1].value / dt) end end |