Metrics and Health
Health endpoints
PoolSwitch exposes:
GET /healthGET /statusGET /metrics
/health is the lightweight readiness endpoint for local checks and load balancers.
Status endpoint
GET /status returns a JSON snapshot of the current key pool.
Typical fields:
- strategy
- storage backend
- upstream base URL
- key id
- total requests
- error count
- failover count
- estimated remaining quota
- last used time
- cooldown timestamp
Metrics endpoint
GET /metrics returns Prometheus-compatible metrics.
PoolSwitch currently tracks:
poolswitch_requests_totalpoolswitch_failovers_totalpoolswitch_key_usage_totalpoolswitch_key_errors_totalpoolswitch_request_latency_secondspoolswitch_key_cooldown_active
Typical production setup
In production, teams usually:
- scrape
/metricswith Prometheus - alert when failovers spike
- alert when all keys are in cooldown
- monitor request latency and error rates
Embedded mode note
In embedded mode, the same metrics objects still exist inside the process, but there is no HTTP /metrics route unless you also run the proxy server.