Skip to main content

Module health

Module health 

Source
Expand description

健康检查端点(liveness / readiness)。 健康检查端点(liveness / readiness)。

提供两个无中间件、不走 CSRF/缓存/超时层的探针端点, 挂载在 static_routes 上,供 Docker HEALTHCHECK 与反向代理/负载均衡使用:

  • GET /healthz — liveness 存活探针。只要进程在跑就返回 200,不查 DB。
  • GET /readyz — readiness 就绪探针。执行 SELECT 1 检测 DB 连通性, 不可达时返回 503,附带连接池指标。

仅在 server feature 启用时编译。

Constants§

PROBE_TIMEOUT 🔒
连接池探活的超时时间。

Functions§

healthz
GET /healthz — liveness 存活探针。
readyz
GET /readyz — readiness 就绪探针。