Documentation
¶
Overview ¶
Package health provides HTTP health check endpoints for Kubernetes-style liveness and readiness probes.
Stability: stable
Package health provides HTTP health check endpoints for Kubernetes-style liveness and readiness probes.
NewServer creates a Server with /healthz (liveness) and /readyz (readiness) endpoints. Readiness checks are configurable via AddReadinessCheck.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckFunc ¶
type CheckFunc func() error
CheckFunc is a function that returns nil when healthy or an error when not.
func EngineCheck ¶
EngineCheck returns a CheckFunc that verifies a float32 CPUEngine is operational by performing a small tensor addition. The check fails if the operation takes longer than the given timeout or returns an error.
type Response ¶
type Response struct {
Status string `json:"status"`
Checks map[string]string `json:"checks,omitempty"`
}
Response is the JSON body returned by health endpoints.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides HTTP health check endpoints.
func NewServer ¶
NewServer creates a new health check server using the given logger. Use WithPprof() to opt in to /debug/pprof/ endpoints.
func (*Server) AddReadinessCheck ¶
AddReadinessCheck registers a named readiness check. All registered checks must pass for the /readyz endpoint to return 200 OK.