Documentation ¶
Overview ¶
Package health implements a node health checker which can emit events when a node goes unhealthy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker is a node health checker. Checker is given a full set of nodes to actively perform checks against.
func NewChecker ¶
NewChecker creates a new health checker. The pool will be used for retrieving gRPC clients. Health change events will be sent to the given Watcher.
Checker will run in the background until Close is called.
func (*Checker) CheckNodes ¶
func (c *Checker) CheckNodes(ds []api.Descriptor) error
CheckNodes will update the set of nodes being checked for health. Subsequent calls to CheckNodes will stop checking nodes that have been removed from ds in between calls.
Fails if the checker is closed.
type Config ¶
type Config struct { // Frequency to check each node. CheckFrequency time.Duration // Timeout for each check. CheckTimeout time.Duration // Maximum number of times a check can fail before the next failure marks as // dead. 0 = dead at the first failure. MaxFailures int Log log.Logger Registerer prometheus.Registerer }
Config configures how the checker performs.
type Watcher ¶
type Watcher interface { // HealthChanged will be invoked whenever the status of a node changes. // Unealthy indicates that the node is suspect and shouldn't be routed // to for messages. // // HealthChanged may be called concurrently. HealthChanged(d api.Descriptor, health api.Health) }
Watcher is an interface used by Checker to send updates about the health of a node as it changes.