Sha256: bb01f4fce4feab756c3637bbdb12c6a1f0acbce7a8607a539c4c59d7ef8e3767
Contents?: true
Size: 540 Bytes
Versions: 10
Compression:
Stored size: 540 Bytes
Contents
require 'honeybadger/metric' module Honeybadger class Gauge < Metric 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 def payloads [ { total: @total, min: @min, max: @max, avg: @avg, latest: @latest } ] end end end
Version data entries
10 entries across 10 versions & 1 rubygems