Class: Hallmonitor::Event
- Inherits:
-
Object
- Object
- Hallmonitor::Event
- Includes:
- Monitored
- Defined in:
- lib/hallmonitor/event.rb
Overview
The event class is a single-fire event, it most often represents a single, countable metric.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#name ⇒ Object
Returns the value of attribute name.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(name, count: 1, tags: {}) ⇒ Event
constructor
Builds a new event.
- #to_json(*a) ⇒ Object
Methods included from Monitored
Constructor Details
#initialize(name, count: 1, tags: {}) ⇒ Event
Builds a new event
15 16 17 18 19 20 |
# File 'lib/hallmonitor/event.rb', line 15 def initialize(name, count: 1, tags: {}) @name = name @time = Time.now @count = count @tags = end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
8 9 10 |
# File 'lib/hallmonitor/event.rb', line 8 def count @count end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/hallmonitor/event.rb', line 8 def name @name end |
#tags ⇒ Object
Returns the value of attribute tags.
8 9 10 |
# File 'lib/hallmonitor/event.rb', line 8 def @tags end |
#time ⇒ Object
Returns the value of attribute time.
8 9 10 |
# File 'lib/hallmonitor/event.rb', line 8 def time @time end |
Instance Method Details
#to_json(*a) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/hallmonitor/event.rb', line 22 def to_json(*a) { name: @name, time: @time, count: @count, tags: @tags }.to_json(*a) end |