Class: Honeybadger::Gauge
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Metric
Instance Method Summary collapse
Methods inherited from Metric
#base_payload, #event_payloads, #initialize, #metric_type, metric_type, register, signature, #signature
Constructor Details
This class inherits a constructor from Honeybadger::Metric
Instance Method Details
#payloads ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/honeybadger/gauge.rb', line 19 def payloads [ { total: @total, min: @min, max: @max, avg: @avg, latest: @latest } ] end |
#record(value) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/honeybadger/gauge.rb', line 5 def record(value) return unless value @samples += 1 @total ||= 0 @total = @total + value @min = value if @min.nil? || @min > value @max = value if @max.nil? || @max < value @avg = @total.to_f / @samples @latest = value end |