Documentation ¶
Index ¶
- func AddAliveHandler(r *mux.Router)
- func AddReadyHandler(r *mux.Router, c Checker)
- func Alive(w http.ResponseWriter, _ *http.Request)
- func Check(checks []Checkable) (err error)
- func DefaultHealthyHandler(w http.ResponseWriter, r *http.Request)
- func DefaultUnhealthyHandler(w http.ResponseWriter, r *http.Request, err error)
- type Checkable
- type Checker
- type StatusResponse
- type StatusResponseDetails
- type UnhealthyHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAliveHandler ¶
AddAliveHandler add the liveness probe handler function into the http server
func AddReadyHandler ¶
AddReadyHandler add the readiness probe handler function into the http server
func DefaultHealthyHandler ¶
func DefaultHealthyHandler(w http.ResponseWriter, r *http.Request)
DefaultHealthyHandler is the handler used if no healthy handler present
func DefaultUnhealthyHandler ¶
func DefaultUnhealthyHandler(w http.ResponseWriter, r *http.Request, err error)
DefaultUnhealthyHandler is the handler used if no unhealthy handler present
Types ¶
type Checkable ¶
type Checkable interface {
Healthy() error
}
Checkable should return nil when the thing they are checking is healthy, and an error otherwise.
func NewGoRoutineChecker ¶
NewGoRoutineChecker returns a new threshold go routine Checker instance
type Checker ¶
type Checker struct { // Checks are the Checkable 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"` }
StatusResponse payloads to respect for check error
type StatusResponseDetails ¶
type StatusResponseDetails struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` }
StatusResponseDetails details for payload error response
type UnhealthyHandler ¶
type UnhealthyHandler func(w http.ResponseWriter, r *http.Request, err error)
UnhealthyHandler type for unhealthy