Sha256: e650015d8fd37173886176aef5c418acca132294f2f499ada332cd1f07e3a6cb
Contents?: true
Size: 810 Bytes
Versions: 8
Compression:
Stored size: 810 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, :tags # Builds a new event # @param name [String] the name of this event # @param count [Number,Hash] the count of this even, defaults to 1. Can # also be a hash of named value pairs # @param tags [Hash<Symbol,String>] Hash of tags to values for this event def initialize(name, count: 1, tags: {}) @name = name @time = Time.now @count = count @tags = tags end def to_json(*a) { name: @name, time: @time, count: @count, tags: @tags }.to_json(*a) end end end
Version data entries
8 entries across 8 versions & 1 rubygems