Class: Rubino::API::Operations::HealthOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/rubino/api/operations/health_operation.rb

Overview

GET /v1/health — readiness probe. No auth required (allowlisted in Middleware::Auth::SKIP_PATHS).

Pings the database and reports scheduler status alongside build info. Returns 503 if any critical dependency is degraded; never raises.

Returns:

  • ([Integer, Hash])

    200 when all deps are ok, 503 otherwise.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(_request) ⇒ Object



14
15
16
# File 'lib/rubino/api/operations/health_operation.rb', line 14

def self.call(_request)
  new.call
end

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
# File 'lib/rubino/api/operations/health_operation.rb', line 18

def call
  deps = { db: db_status, scheduler: scheduler_status }
  status = deps.values.all? { |s| s[:status] == "ok" } ? 200 : 503
  [status, {
    status: status == 200 ? "ok" : "degraded",
    version: Rubino::VERSION,
    deps: deps
  }]
end