Observability
Health
Section titled “Health”GET /health(liveness)- Always returns
200with{"status":"ok"}if the server is running.
- Always returns
GET /ready(readiness)- Returns
200with{"status":"ready"}when the DB can be reached. - Returns
503with{"status":"unavailable"}when the DB is unavailable.
- Returns
Example:
curl -sS http://localhost:8080/healthcurl -sS http://localhost:8080/readyMetrics
Section titled “Metrics”GET /metrics(Prometheus exposition format)
By default, /metrics is public. To require Bearer auth:
export METRICS_AUTH_ENABLED=trueWhen auth is enabled, /metrics uses the same Bearer tokens as the API (AUTH_TOKENS / legacy AUTH_TOKEN):
TOKEN=token-currentcurl -H "Authorization: Bearer ${TOKEN}" http://localhost:8080/metricsPrometheus scraping notes:
- If you enable auth, prefer supplying the token via
bearer_token_file(or similar) rather than embedding it directly in config. - Alternatively, leave
METRICS_AUTH_ENABLED=falseand restrict/metricsat the network/reverse-proxy layer.
Request IDs
Section titled “Request IDs”mjr.wtf propagates X-Request-ID:
- If the request includes
X-Request-ID, it is reused. - Otherwise a UUID is generated.
The value is echoed back on responses via the X-Request-ID header and included in request logs as request_id.
Logging
Section titled “Logging”Logging is structured via zerolog.
LOG_LEVEL(default:info)LOG_FORMAT(jsonorpretty, default:json)LOG_STACK_TRACES(default:true; include stack traces in panic recovery logs)
Each HTTP request is logged with fields like request_id, method, path, status, size, and duration.