Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Health & Readiness API

Canonical reference: docs/api-reference.md (generated endpoint directory) — this page is a task-oriented summary.

Sol exposes three operational health endpoints plus a Prometheus metrics scrape endpoint. The health and readiness probes are designed for very different audiences:

/api/v1/health is a shallow check — it tells you the HTTP server is up and how many models are running. Use it for liveness probes that should succeed as long as the BEAM is answering HTTP. /api/v1/ready is a deep check that runs 19 subsystem probes and returns 503 if any critical component is degraded. Use it for Kubernetes readiness, load-balancer health, and deployment gates. /api/v1/infra/status (see Infra) is the detailed per-service status with reasons and counts — the deep version that operators read when /ready is failing.

/api/v1/health and /api/v1/ready are on the auth-exempt list so infrastructure probes can hit them without credentials.

Health Check (shallow)

GET /health
GET /api/v1/health

Both aliases run the same handler and return the same body. No authentication required.

Response (200):

{
  "status": "ok",
  "models_running": 2
}
FieldDescription
statusAlways "ok" when the handler can answer.
models_runningCount of currently running inference models (sol_registry:list_running). Falls back to 0 if the registry call fails.

This endpoint never returns subsystem details, a checks array, or a degraded status — for that, use /api/v1/ready (which still omits details, see below) or /api/v1/infra/status (which includes them).

curl http://localhost:21434/api/v1/health

Readiness Probe (deep)

GET /api/v1/ready

Runs all 19 subsystem checks via sol_health:check_all/0. Returns 200 only when every check passes; 503 otherwise.

Response (200, healthy):

{
  "status": "ok",
  "checks": [
    { "name": "providers", "status": "ok" },
    {"name": "init", "status": "ok"},
    {"name": "mnesia", "status": "ok"},
    {"name": "zmq", "status": "ok"},
    {"name": "mango", "status": "ok"},
    {"name": "orchestrator_lease", "status": "ok"},
    {"name": "projection", "status": "ok"},
    {"name": "postgres", "status": "ok"},
    {"name": "ets", "status": "ok"},
    {"name": "listeners", "status": "ok"},
    {"name": "disk", "status": "ok"},
    {"name": "process_util", "status": "ok"},
    {"name": "memory_util", "status": "ok"},
    {"name": "message_queues", "status": "ok"},
    {"name": "models", "status": "ok"},
    {"name": "workers", "status": "ok"},
    {"name": "core_data_plane", "status": "ok"},
    {"name": "backup", "status": "ok"},
    {"name": "audit", "status": "ok"}
  ]
}

Response (503, degraded):

{
  "status": "degraded",
  "checks": [
    {"name": "mnesia", "status": "ok"},
    {"name": "zmq", "status": "error"},
    {"name": "disk", "status": "warning"}
  ]
}

providers — readiness check (see the /api/v1/ready list)

Checks array shape

Each entry has exactly two keys:

{ "name": "<subsystem>", "status": "ok|warning|error" }

There is intentionally no details field. /api/v1/ready is on the auth-exempt list, so the full reason strings are stripped to avoid leaking internal state (paths, hostnames, error reasons) to unauthenticated callers. The detail maps are logged server-side at warning level for operator diagnostics. To see details in the response body, use the admin-gated /api/v1/infra/status endpoint.

Subsystems checked

CheckError conditions
initApplication init tasks (event_store, workflow_defs, provider_boot) failed
mnesiaMnesia not started / not running
zmqZMQ gateway not responding
mangoMango auth service unreachable
orchestrator_leaseOrchestrator single-writer lease not confirmed/held: an unfenced (never-confirmed) boot or a stale hold is an error unless orchestrator_lease_stale_hold_ack=true; a fenced loser, an authority refusal or a holder-but-fenced deadlock is always an error. Reports gateway_fenced so the deploy probe sees a quiesced gateway. Independent of mango (Mango-down already fails that row; this one never reads it).
postgresPostgreSQL pool health check failed
etsCore ETS tables missing
listenersNo Cowboy HTTP listener bound
diskDisk below critical (100 MB) or warning (1 GB)
process_utilProcess count > 80% (warning) / 95% (error) of limit
memory_utilBEAM total memory > 4 GB (warning)
message_queuesAny process mailbox > 100 messages
modelsConfigured models exist but zero are ready (running/prepared) — an error when a fleet is expected (health_expect_models, default: any registered row); an absent table is “not configured”, never green-by-accident
workersZero workers while a fleet is expected (fleet expected but no workers are registered; expectation = health_expect_workers, else zmq_enabled AND initial_workers > 0 — the shipped entrypoint renders initial_workers=1). Staleness uses worker_heartbeat_timeout_ms (shipped 15000 ms; code fallback 45000). A fresh deploy with no worker therefore returns 503.
core_data_planeA core data-plane owner is missing/suspended, or its mailbox is over the warning (5000) / critical (20000) bound
projectionThe per-boot projection proof is missing (event_replay_on_boot=false/degraded boot) — the RAM views may be empty; event retention is refused until a replay (projection_unproven).
backupLocal scheduled backup disabled in prod (air-gap still requires it: local_backup_required), no off-host target in prod without airgap_mode=true (offhost_target_required), or the last backup failed. airgap_mode=true relaxes only the off-host leg.
auditAudit sink not running, or the flush is persistently degraded (configured-but-unreadable is an error)

Prometheus Metrics

GET /metrics

Exposes metrics in Prometheus text exposition format (text/plain; version=0.0.4). Auth-exempt (Alloy scrapes on a 15 s interval).

curl http://localhost:21434/metrics

Sample output:

# HELP sol_http_2xx_total HTTP 2xx responses (SLO)
# TYPE sol_http_2xx_total counter
sol_http_2xx_total 1234

# HELP sol_errors_total Error counts by module and category
# TYPE sol_errors_total counter
sol_errors_total{module="sol_pipeline",category="timeout"} 3

# HELP sol_latency_us Latency in microseconds
# TYPE sol_latency_us summary
sol_latency_us{quantile="0.50",name="http_request"} 12000
sol_latency_us{quantile="0.95",name="http_request"} 45000
sol_latency_us{quantile="0.99",name="http_request"} 245000

Metric families

FamilyTypeDescription
sol_*_totalcounterRequest, task, worker counters
sol_errors_totalcounterErrors by module and category
sol_latency_*summaryRequest latency histogram
sol_circuit_breaker_stategaugeCircuit breaker open/closed
sol_workers_*gaugeWorker count and status
sol_models_*gaugeModel availability
sol_uptime_secondsgaugeServer uptime
sol_build_infogaugeVersion and build metadata
sol_process_*gaugeErlang process metrics
sol_memory_*gaugeBEAM memory metrics
sol_ets_countgaugeETS table row counts
sol_task_queue_*gaugeTask queue depth
sol_cluster_nodesgaugeConnected cluster nodes
sol_availability_percentgaugeCalculated availability

The internal JSON metrics counters exposed at GET /api/v1/metrics are a separate, application-level snapshot — not the Prometheus scrape format.

Infra — admin-gated detailed service status (GET /api/v1/infra/status), maintenance mode, cache invalidation