docs: sync from backend 8e03360 — auth health hotfix

This commit is contained in:
Siavash Sameni
2026-05-31 16:28:09 +04:00
parent 35640e38cc
commit e8a1bba471
3 changed files with 23 additions and 5 deletions

View File

@@ -67,10 +67,10 @@ The `GET /api/health` endpoint was shipped in backend 2.6.49. It is public, rate
**Shape of the endpoint:**
```ts
// GET /api/health (public, rate-limited but not auth-gated)
// GET /api/health (public, skipped by the global rate limiter)
{
"status": "ok" | "degraded" | "down",
"version": "2.6.48",
"version": "2.6.84",
"uptimeSec": 12345,
"checks": {
"db": { "ok": true, "latencyMs": 4 },
@@ -82,7 +82,7 @@ The `GET /api/health` endpoint was shipped in backend 2.6.49. It is public, rate
}
```
Each `checks.*.ok` must reflect the actual current state, not a cached one. If any check fails, `status` flips to `degraded`. If `db.ok === false`, `status` flips to `down`.
Each `checks.*.ok` reflects the current backend state, except `rnApi`, which is cached for 60 seconds as of backend `2.6.84` to avoid monitoring-induced upstream rate limits. `rnApi.status === 429` is treated as reachable because Request Network answered; 5xx/timeouts still degrade the report. If any non-DB check fails, `status` flips to `degraded`. If `db.ok === false`, `status` flips to `down`.
**Why this shape rather than per-check endpoints:**
- One probe, all invariants — cheaper for Gatus and clearer in the dashboard.

View File

@@ -14,7 +14,7 @@ What's instrumented today and what to watch. Today's stack is intentionally lean
Two paths are registered (both are public, rate-limited, not auth-gated):
- `GET /health` — simple ping used by Docker healthchecks. Returns `200 { success, message, timestamp, environment, version }`. Does **not** probe MongoDB or Redis.
- `GET /api/health` — deep health check added in commit `44579d6` (backend v2.6.49). Calls `runHealthChecks` from `backend/src/services/health/healthCheckService.ts`. Probes MongoDB and Redis, collects memory/uptime stats, and returns a structured report. Returns `503` when `report.status === 'down'`.
- `GET /api/health` — deep health check added in commit `44579d6` (backend v2.6.49). Calls `runHealthChecks` from `backend/src/services/health/healthCheckService.ts`. Probes MongoDB, Redis, Request Network registry data, and Request Network API reachability. Returns `503` only when `report.status === 'down'`. As of backend `2.6.84`, the RN API subcheck is cached for 60 seconds and treats non-5xx HTTP responses, including `429`, as upstream reachable so Gatus/perf probes do not turn a live backend into `degraded`.
`GET /api/health` response shape (from `healthCheckService`):
```json
@@ -22,7 +22,13 @@ Two paths are registered (both are public, rate-limited, not auth-gated):
"status": "ok",
"version": "2.6.xx",
"timestamp": "...",
"checks": { "mongodb": "ok", "redis": "ok", "uptime": 3600, "memoryMB": 120 }
"checks": {
"db": { "ok": true, "latencyMs": 4 },
"redis": { "ok": true, "latencyMs": 1 },
"rnChainRegistry": { "ok": true, "latencyMs": 0, "chainCount": 7 },
"rnTokenRegistry": { "ok": true, "latencyMs": 0, "tokenCount": 12 },
"rnApi": { "ok": true, "latencyMs": 134, "status": 401 }
}
}
```