Skip to content
API > API reference

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
# ok

GET /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
}
FieldMeaning
versionRelay crate version
uptime_secondsSeconds since the process started
inflightConnections currently being served
providers_configuredWhich model providers have keys configured (names only)
auth_storeWhether the account store is reachable/configured
memory_storeWhether 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 inflight gauge
  • agent_ttft_ms and agent_total_ms latency 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.