Documentation ¶
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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
type StatusResponse ¶
type StatusResponse struct { Status string `json:"status"` Details *StatusResponseDetails `json:"details,omitempty"` }
type StatusResponseDetails ¶
type UnhealthyHandler ¶
type UnhealthyHandler func(w http.ResponseWriter, r *http.Request, err error)
Click to show internal directories.
Click to hide internal directories.