Sha256: 673109e9b5463d044dc348d9b130e3e64e10f46460df20533a46d2ada80979d7

Contents?: true

Size: 780 Bytes

Versions: 3

Compression:

Stored size: 780 Bytes

Contents

module Hallmonitor
  # A Gauge event is an event that has a specific value,
  # think of it like a tachometer or gas gauge on a car:
  # at any given point it reports the current value of a
  # variable.
  class GaugeEvent < Event
    # @param name [String] Name of this guage
    # @param value [Number] The current value of this guage
    def initialize(name, value: nil, tags: {})
      super(name, count: value, tags: tags)
    end

    # The value of this guage
    def value
      count
    end

    # Sets the value of this guage
    # @param new_value [Number]
    def value=(new_value)
      self.count = new_value
    end

    def to_json(*a)
      {
        name: name,
        time: time,
        value: count,
        tags: tags
      }.to_json(*a)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hallmonitor-5.2.0 lib/hallmonitor/gauge_event.rb
hallmonitor-5.1.0 lib/hallmonitor/gauge_event.rb
hallmonitor-5.0.0 lib/hallmonitor/gauge_event.rb