Overview
The current /health endpoint returns a static { status: 'ok' }. It gives no insight into whether Redis is reachable, Horizon RPC is responsive, or price sources are functional — making it useless as a readiness probe or for on-call triage.
New Response Format
{
"status": "degraded",
"uptime_seconds": 3847,
"checks": {
"redis": { "status": "ok", "latency_ms": 2 },
"horizon": { "status": "ok", "latency_ms": 89, "ledger": 52341200 },
"coingecko": { "status": "ok", "circuit": "closed" },
"coinmarketcap": { "status": "degraded", "circuit": "open", "reason": "rate_limited" },
"stellar_dex": { "status": "ok", "circuit": "closed" }
}
}
Status rules:
ok: all checks pass
degraded: at least one non-critical check failing (price source)
error: critical dependency (Redis) is unreachable
HTTP status codes:
ok → 200
degraded → 200 (load balancer keeps it in rotation)
error → 503
Implementation
- Run all dependency checks in parallel with
Promise.allSettled
- Redis check:
redis.ping() with 2s timeout
- Horizon check: fetch
/ endpoint (returns ledger info) with 5s timeout
- Price source check: report circuit breaker state (no live HTTP call)
Acceptance Criteria
Overview
The current
/healthendpoint returns a static{ status: 'ok' }. It gives no insight into whether Redis is reachable, Horizon RPC is responsive, or price sources are functional — making it useless as a readiness probe or for on-call triage.New Response Format
{ "status": "degraded", "uptime_seconds": 3847, "checks": { "redis": { "status": "ok", "latency_ms": 2 }, "horizon": { "status": "ok", "latency_ms": 89, "ledger": 52341200 }, "coingecko": { "status": "ok", "circuit": "closed" }, "coinmarketcap": { "status": "degraded", "circuit": "open", "reason": "rate_limited" }, "stellar_dex": { "status": "ok", "circuit": "closed" } } }Status rules:
ok: all checks passdegraded: at least one non-critical check failing (price source)error: critical dependency (Redis) is unreachableHTTP status codes:
ok→ 200degraded→ 200 (load balancer keeps it in rotation)error→ 503Implementation
Promise.allSettledredis.ping()with 2s timeout/endpoint (returns ledger info) with 5s timeoutAcceptance Criteria
/healthreturns dependency check mapuptime_seconds