Class: StandardHealth::Aggregator

Inherits:
Object
  • Object
show all
Defined in:
lib/standard_health/aggregator.rb

Overview

Runs all registered checks and rolls them up into a single status.

Status semantics:

:ok           — every check returned :ok
:degraded     — at least one non-critical check failed
:unavailable  — at least one critical check failed

The aggregator never raises. Each check is invoked through ‘safe_run` which catches `StandardError` so a buggy custom check cannot take down /ready.

Class Method Summary collapse

Class Method Details

.call(checks: StandardHealth.config.checks, now: Time.now.utc) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/standard_health/aggregator.rb', line 15

def self.call(checks: StandardHealth.config.checks, now: Time.now.utc)
  check_rows = checks.map { |reg| safe_run(reg) }
  {
    status: overall_status(check_rows),
    checks: check_rows,
    generated_at: now.iso8601
  }
end