Health & metrics
Health checks, deep readiness, and the metrics endpoint.
The relay exposes three operational endpoints: a public liveness probe, an admin-gated readiness snapshot, and an admin-gated Prometheus metrics feed. Together they are the entire observability surface — none of them ever leak prompts, keys, tokens, or emails.
GET /health
Public. Returns 200 ok as plain text. This is the endpoint the Mel app polls at startup (ensure_relay()) before its first agent turn, and the one hosting platforms use for health checks.
curl -s https://<relay-host>/health
# okGET /health/deep
Admin-token only — any other caller gets 401 unauthorized. Returns a structured readiness snapshot for ops dashboards. It contains no secrets: provider names only, never keys.
{
"status": "ok",
"version": "0.1.0",
"uptime_seconds": 1234,
"inflight": 3,
"providers_configured": ["gemini", "groq"],
"auth_store": true,
"memory_store": false
}| Field | Meaning |
|---|---|
version | Relay crate version |
uptime_seconds | Seconds since the process started |
inflight | Connections currently being served |
providers_configured | Which model providers have keys configured (names only) |
auth_store | Whether the account store is reachable/configured |
memory_store | Whether project memory storage is enabled |
GET /metrics
Admin-token only (401 unauthorized otherwise). Prometheus text exposition (text/plain; version=0.0.4) of the relay's in-process metrics:
- request and error counters
- per-provider volume
- fallback frequency and quota exhaustion
- token counts
- the
inflightgauge agent_ttft_msandagent_total_mslatency histograms — server-side time-to-first-token and total latency for agent streaming requests
Point a Prometheus scraper at it with the admin token in the Authorization header, or read it ad hoc:
curl -s https://<relay-host>/metrics \
-H "Authorization: Bearer $ADMIN_TOKEN"Logs and CloudWatch EMF
In production the same measurements are also emitted as CloudWatch EMF JSON lines to stdout — one per completed /v1/agent/stream request — so CloudWatch extracts the metrics with no scraper running.
All relay logs are structured JSON. RUST_LOG tunes verbosity. Logs contain no prompt or response content, no keys, no tokens, and no emails; user ids are truncated.
Related
- API overview & auth — how the admin Bearer token is obtained and presented
- Agent streaming — the endpoint these latency histograms measure