 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
- type Check
- type CheckFn
- 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 Check) error
- func (h *Health) RegisterCheckFunc(name string, checkFn CheckFn) error
- func (h *Health) RegisterHeartbeat(name string, hb Heartbeater, max time.Duration) error
- func (h *Health) RegisterMonotonicCheckFunc(name string, checkFn CheckFn) 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 ¶
This section is empty.
Types ¶
type Check ¶
type Check interface {
	// Name is the identifier for this check and must be unique among all Checks
	Name() string
	// Execute performs the health check. It returns nil if the check passes.
	// It can also return additional information to marshal and display to the caller
	Execute() (interface{}, error)
	// ExecutionPeriod is the duration to wait between executions of this Check
	ExecutionPeriod() time.Duration
	// InitialDelay is the duration to wait before executing the first time
	InitialDelay() time.Duration
	// InitiallyPassing is whether or not to consider the Check healthy before the
	// initial execution
	InitiallyPassing() bool
}
    Check defines a single health check that we want to monitor and consider as part of our wider healthiness
type CheckFn ¶
type CheckFn func() (interface{}, error)
    CheckFn returns optional status information and an error indicating health or non-health
func HeartbeatCheckFn ¶
func HeartbeatCheckFn(hb Heartbeater, max time.Duration) CheckFn
HeartbeatCheckFn returns a CheckFn that checks the given heartbeater has pulsed within the given duration
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) RegisterCheckFunc ¶
RegisterCheckFunc adds a Check with default options and the given CheckFn
func (*Health) RegisterHeartbeat ¶
RegisterHeartbeat adds a check with default options and a CheckFn that checks the given heartbeater for a recent heartbeat
type Heartbeater ¶
type Heartbeater interface {
	GetHeartbeat() int64
}
    Heartbeater provides a getter to the most recently observed heartbeat