package health
import "github.com/coreos/pkg/health"
Index ¶
- func Check(checks []Checkable) (err error)
- func DefaultHealthyHandler(w http.ResponseWriter, r *http.Request)
- func DefaultUnhealthyHandler(w http.ResponseWriter, r *http.Request, err error)
- func ExpvarHandler(w http.ResponseWriter, r *http.Request)
- type Checkable
- type Checker
- type StatusResponse
- type StatusResponseDetails
- type UnhealthyHandler
Functions ¶
func Check ¶
func DefaultHealthyHandler ¶
func DefaultHealthyHandler(w http.ResponseWriter, r *http.Request)
func DefaultUnhealthyHandler ¶
func DefaultUnhealthyHandler(w http.ResponseWriter, r *http.Request, err error)
func ExpvarHandler ¶
func ExpvarHandler(w http.ResponseWriter, r *http.Request)
ExpvarHandler is copied from https://golang.org/src/expvar/expvar.go, where it's sadly unexported.
Types ¶
type Checkable ¶
type Checkable interface { Healthy() error }
Checkables should return nil when the thing they are checking is healthy, and an error otherwise.
type Checker ¶
type Checker struct { // Checks are the Checkables to be checked when probing. Checks []Checkable // Unhealthyhandler is called when one or more of the checks are unhealthy. // If not provided DefaultUnhealthyHandler is called. UnhealthyHandler UnhealthyHandler // HealthyHandler is called when all checks are healthy. // If not provided, DefaultHealthyHandler is called. HealthyHandler http.HandlerFunc }
Checker provides a way to make an endpoint which can be probed for system health.
func (Checker) ServeHTTP ¶
func (c Checker) ServeHTTP(w http.ResponseWriter, r *http.Request)
type StatusResponse ¶
type StatusResponse struct { Status string `json:"status"` Details *StatusResponseDetails `json:"details,omitempty"` }
type StatusResponseDetails ¶
type StatusResponseDetails struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` }
type UnhealthyHandler ¶
type UnhealthyHandler func(w http.ResponseWriter, r *http.Request, err error)
Source Files ¶
- Version
- v0.0.0-20240122114842-bbd7aa9bf6fb (latest)
- Published
- Jan 22, 2024
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 2 weeks ago –
Tools for package owners.