Health, Readiness, and Metrics API
-
Liveness
/healthreturns process liveness. -
Readiness
/readyverifies DB connectivity. -
Metrics
/metricsexposes Prometheus metrics.
Gate Traffic
Route production traffic only after readiness returns 200.
Exporter
A Postgres exporter is included in the compose stack; scrape it alongside /metrics.
High-cardinality
Avoid per-query labels in custom metrics. Aggregate by corpus or retriever.
import httpx
print(httpx.get("http://localhost:8000/health").json())
print(httpx.get("http://localhost:8000/ready").json())
print(httpx.get("http://localhost:8000/metrics").text[:200])
curl -sS http://localhost:8000/health | jq .
curl -sS http://localhost:8000/ready | jq .
curl -sS http://localhost:8000/metrics | head -n 20
await fetch('/health')
await fetch('/ready')
const m = await (await fetch('/metrics')).text();
console.log(m.split('\n').slice(0,5))
flowchart LR
Scrape["Prometheus"] --> API_METRICS["/metrics"]
API_METRICS --> APP["TriBridRAG"]
APP --> PG["Postgres"]
APP --> NEO["Neo4j"]
Scrape --> PExp["postgres-exporter"] Loki/Grafana
Logs and dashboards are available via Loki and Grafana services started by docker compose.