Health Checks & Metrics

Designed so production never leaks data: the public endpoint says only ok or error, everything else needs a token, a direct local connection or a one-time code.

EndpointEnabledWho can read itContent
/healthApp(health=True) (default)everyone{"status": "ok"} 200 or {"status": "error"} 503 (database ping, cached 5 s)
/health/detailswith /healthtoken / local / OTPuptime, process RSS/CPU/threads/FDs, cache stats, task queue counts
/metricsApp(metrics=True)token / local / OTPPrometheus text format

If your project already defines /health or /metrics, Lila does not replace them.

Access rules

Terminal
# on the server, with METRICS_OTP=true
curl -s http://127.0.0.1:8000/health/details            # 401 {"otp_required": true}
sudo journalctl -u my-shop -n 5 | grep "One-time code"   # [Lila] One-time code for /health/details: 482913
curl -s -H "X-Lila-OTP: 482913" http://127.0.0.1:8000/health/details
prometheus.yml
# prometheus.yml
scrape_configs:
  - job_name: lila
    metrics_path: /metrics
    authorization:
      credentials: "<METRICS_TOKEN>"
    static_configs:
      - targets: ["127.0.0.1:8000"]

Metrics exported