Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrHealthCheckFailed = errors.New("Health check failed")
ErrHealthCheckFailed is a generic error returned when a check fails
Functions ¶
Types ¶
type HealthChecker ¶
HealthChecker is responsible for checking certain resources
type HealthService ¶
HealthService is the HTTP handler implementation which wraps the Probe and Checker logic
func (*HealthService) HealthStatus ¶
func (hs *HealthService) HealthStatus(w http.ResponseWriter, r *http.Request)
HealthStatus checks if the application is healthy
func (*HealthService) ReadinessStatus ¶
func (hs *HealthService) ReadinessStatus(w http.ResponseWriter, r *http.Request)
ReadinessStatus checks if the app is ready for accepting request (eg. database is available as well)
type Probe ¶
type Probe struct {
// contains filtered or unexported fields
}
Probe is responsible for executing a series of checks and decide if the service is up or not
func NewProbe ¶
func NewProbe(checkers ...HealthChecker) *Probe
NewProbe is a shortcut for easily creating a new Probe
type StatusHealthChecker ¶
type StatusHealthChecker struct {
Status bool
}
StatusHealthChecker checks the status based on an internal
func (*StatusHealthChecker) Ping ¶
func (s *StatusHealthChecker) Ping() error
Ping checks the internal status and returns an error if it is false
func (*StatusHealthChecker) Type ¶
func (s *StatusHealthChecker) Type() string
Type returns the name of the status checker