Documentation ¶
Index ¶
- Variables
- func HeartbeatCheckFn(hb Heartbeater, max time.Duration) func() (interface{}, error)
- func NewCheck(name string, execute func() (interface{}, error)) checks.Check
- type GetLivenessArgs
- type GetLivenessReply
- type Health
- func (h *Health) GetLiveness(_ *http.Request, _ *GetLivenessArgs, reply *GetLivenessReply) error
- func (h *Health) Handler() (*common.HTTPHandler, error)
- func (h *Health) RegisterCheck(c checks.Check) error
- func (h *Health) RegisterHeartbeat(name string, hb Heartbeater, max time.Duration) error
- func (h *Health) RegisterMonotonicCheckFunc(name string, checkFn func() (interface{}, error)) error
- type Heartbeater
Constants ¶
This section is empty.
Variables ¶
var ( // ErrHeartbeatNotDetected is returned from a HeartbeatCheckFn when the // heartbeat has not been detected recently enough ErrHeartbeatNotDetected = errors.New("heartbeat not detected") )
Functions ¶
func HeartbeatCheckFn ¶
func HeartbeatCheckFn(hb Heartbeater, max time.Duration) func() (interface{}, error)
HeartbeatCheckFn returns a CheckFn that checks the given heartbeater has pulsed within the given duration
Types ¶
type GetLivenessArgs ¶
type GetLivenessArgs struct{}
GetLivenessArgs are the arguments for GetLiveness
type GetLivenessReply ¶
type GetLivenessReply struct { Checks map[string]health.Result `json:"checks"` Healthy bool `json:"healthy"` }
GetLivenessReply is the response for GetLiveness
type Health ¶
type Health struct {
// contains filtered or unexported fields
}
Health observes a set of vital signs and makes them available through an HTTP API.
func NewService ¶
NewService creates a new Health service
func (*Health) GetLiveness ¶
func (h *Health) GetLiveness(_ *http.Request, _ *GetLivenessArgs, reply *GetLivenessReply) error
GetLiveness returns a summation of the health of the node
func (*Health) Handler ¶
func (h *Health) Handler() (*common.HTTPHandler, error)
Handler returns an HTTPHandler providing RPC access to the Health service
func (*Health) RegisterCheck ¶
RegisterCheck adds the given Check
func (*Health) RegisterHeartbeat ¶
RegisterHeartbeat adds a check with default options and a CheckFn that checks the given heartbeater for a recent heartbeat
func (*Health) RegisterMonotonicCheckFunc ¶
RegisterMonotonicCheckFunc adds a Check with default options and the given CheckFn After it passes once, its logic (checkFunc) is never run again; it just passes
type Heartbeater ¶
type Heartbeater interface {
GetHeartbeat() int64
}
Heartbeater provides a getter to the most recently observed heartbeat