Class: Arkaan::Monitoring::Results::Report
- Inherits:
-
Object
- Object
- Arkaan::Monitoring::Results::Report
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/arkaan/monitoring/results/report.rb
Overview
A report is the result of one call to the API on one instance status route.
Instance Attribute Summary collapse
-
#ended_at ⇒ DateTime
The timestamp at which the report ends.
-
#healthy ⇒ Integer
The number of healthy services amongst all the monitored services.
-
#records ⇒ Array<Arkaan::Monitoring::Results::Record>
The records linked to this report.
-
#total ⇒ Integer
The total number of services monitored.
-
#vigilante ⇒ Arkaan::Monitoring::Vigilante
The vigilante application that has created this report.
Instance Method Summary collapse
Instance Attribute Details
#ended_at ⇒ DateTime
Returns the timestamp at which the report ends.
13 |
# File 'lib/arkaan/monitoring/results/report.rb', line 13 field :ended_at, type: DateTime |
#healthy ⇒ Integer
Returns the number of healthy services amongst all the monitored services.
19 |
# File 'lib/arkaan/monitoring/results/report.rb', line 19 field :healthy, type: Integer, default: 0 |
#records ⇒ Array<Arkaan::Monitoring::Results::Record>
Returns the records linked to this report.
23 |
# File 'lib/arkaan/monitoring/results/report.rb', line 23 has_many :heartbeats, class_name: 'Arkaan::Monitoring::Results::Heartbeat', inverse_of: :report |
#total ⇒ Integer
Returns the total number of services monitored.
16 |
# File 'lib/arkaan/monitoring/results/report.rb', line 16 field :total, type: Integer, default: 0 |
#vigilante ⇒ Arkaan::Monitoring::Vigilante
Returns the vigilante application that has created this report.
26 |
# File 'lib/arkaan/monitoring/results/report.rb', line 26 belongs_to :vigilante, class_name: 'Arkaan::Monitoring::Vigilante', inverse_of: :reports |
Instance Method Details
#add_heartbeat(heartbeat) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/arkaan/monitoring/results/report.rb', line 28 def add_heartbeat(heartbeat) self.heartbeats << heartbeat self.total += 1 self.healthy += (heartbeat.healthy ? 1 : 0) heartbeat.end! end |
#end! ⇒ Object
39 40 41 42 |
# File 'lib/arkaan/monitoring/results/report.rb', line 39 def end! self.ended_at = DateTime.now self.save! end |
#start! ⇒ Object
35 36 37 |
# File 'lib/arkaan/monitoring/results/report.rb', line 35 def start! self.started_at = DateTime.now end |