Class: Arkaan::Monitoring::Results::Heartbeat

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document
Defined in:
lib/arkaan/monitoring/results/heartbeat.rb

Overview

A record is the result of the vigilante asking the health of one instance.

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyHash

Returns the JSON parsed body from the heartbeat request.

Returns:

  • (Hash)

    the JSON parsed body from the heartbeat request.



14
# File 'lib/arkaan/monitoring/results/heartbeat.rb', line 14

field :body, type: Hash, default: {}

#ended_atDateTime

Returns the date at which the request was terminated.

Returns:

  • (DateTime)

    the date at which the request was terminated.



23
# File 'lib/arkaan/monitoring/results/heartbeat.rb', line 23

field :ended_at, type: DateTime

#healthyBoolean

Returns TRUE if the instance is deemed healthy, FALSE otherwise.

Returns:

  • (Boolean)

    TRUE if the instance is deemed healthy, FALSE otherwise.



17
# File 'lib/arkaan/monitoring/results/heartbeat.rb', line 17

field :healthy, type: Boolean, default: false

#instanceArkaan::Monitoring::Instance

Returns the instance on which the record has been done.

Returns:



27
# File 'lib/arkaan/monitoring/results/heartbeat.rb', line 27

belongs_to :instance, class_name: 'Arkaan::Monitoring::Instance', inverse_of: :heartbeats

#reportArkaan::Monitoring::Results::Report

Returns the report made by the vigilante including this record.

Returns:



31
# File 'lib/arkaan/monitoring/results/heartbeat.rb', line 31

belongs_to :report, class_name: 'Arkaan::Monitoring::Results::Report', inverse_of: :heartbeats

#started_atDateTime

Returns the date at which the heartbeat request has started.

Returns:

  • (DateTime)

    the date at which the heartbeat request has started.



20
# File 'lib/arkaan/monitoring/results/heartbeat.rb', line 20

field :started_at, type: DateTime

#statusInteger

Returns the HTTP status of the request made for this record.

Returns:

  • (Integer)

    the HTTP status of the request made for this record.



11
# File 'lib/arkaan/monitoring/results/heartbeat.rb', line 11

field :status, type: Integer, default: 500

Instance Method Details

#end!Object



44
45
46
# File 'lib/arkaan/monitoring/results/heartbeat.rb', line 44

def end!
  self.ended_at = DateTime.now
end

#start!Object



40
41
42
# File 'lib/arkaan/monitoring/results/heartbeat.rb', line 40

def start!
  self.started_at = DateTime.now
end