Class: ElasticGraph::HealthCheck::HealthStatus::LatestRecord

Inherits:
Data
  • Object
show all
Defined in:
lib/elastic_graph/health_check/health_status.rb

Overview

Encapsulates information about the latest record of a type.

Instance Method Summary collapse

Instance Method Details

#to_loggable_description(type) ⇒ Object



74
75
76
77
78
79
80
81
82
# File 'lib/elastic_graph/health_check/health_status.rb', line 74

def to_loggable_description(type)
  rounded_age = seconds_newer_than_required.round(2).abs

  if too_old?
    "Latest #{type} (too old): #{id} / #{timestamp.iso8601} (#{rounded_age}s too old)"
  else
    "Latest #{type} (recent enough): #{id} / #{timestamp.iso8601} (#{rounded_age}s newer than required)"
  end
end

#too_old?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/elastic_graph/health_check/health_status.rb', line 84

def too_old?
  seconds_newer_than_required < 0
end