Sha256: b57cd4701649c30856c440163d7d3d4f16d2cedf77b29a71577ef06a9226d08e

Contents?: true

Size: 619 Bytes

Versions: 1

Compression:

Stored size: 619 Bytes

Contents

require 'hallmonitor/monitored'
module Hallmonitor
  # The event class is a single-fire event, it most often
  # represents a single, countable metric.
  class Event
    include Hallmonitor::Monitored

    attr_accessor :name, :time, :count

    # Builds a new event
    # @param name [String] the name of this event
    # @param count [Number] the count of this even, defaults to 1
    def initialize(name, count=1)
      @name = name
      @time = Time.now
      @count = count
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hallmonitor-1.0.0 lib/hallmonitor/event.rb