health

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckFunc added in v1.1.0

type CheckFunc func() (unwell bool, meta Meta)

type Checkable

type Checkable interface {
	// Checkables should return nil if ready, or an error message otherwise.
	Ready() error
	// Checkables should return nil if healthy, or an error message otherwise.
	Healthy() error
}

Types requiring health checks should implement the Checkable interface.

type Checker

type Checker interface {
	// Register a service for health checks.
	Register(name string, service Checkable) error
	// Unregister a service.
	Unregister(name string) error
	// IsReady returns the current readiness of the system.
	// A system is considered ready if all checks are passing (no errors)
	IsReady() (ready bool, errors map[string]error)
	// IsHealthy returns the current health of the system.
	// A system is considered healthy if all checks are passing (no errors)
	IsHealthy() (healthy bool, errors map[string]error)

	Start() error
	Close() error
}

Checker provides a service which can be probed for system health.

func NewChecker

func NewChecker() Checker

type Config added in v1.1.0

type Config interface {
	AutoPprofProfileRoot() string
	AutoPprofPollInterval() models.Duration
	AutoPprofGatherDuration() models.Duration
	AutoPprofGatherTraceDuration() models.Duration
	AutoPprofMaxProfileSize() utils.FileSize
	AutoPprofCPUProfileRate() int
	AutoPprofMemProfileRate() int
	AutoPprofBlockProfileRate() int
	AutoPprofMutexProfileFraction() int
	AutoPprofMemThreshold() utils.FileSize
	AutoPprofGoroutineThreshold() int
}

type Meta added in v1.1.0

type Meta map[string]interface{}

type Nurse added in v1.1.0

type Nurse struct {
	utils.StartStopOnce
	// contains filtered or unexported fields
}

func NewNurse added in v1.1.0

func NewNurse(cfg Config, log logger.Logger) *Nurse

func (*Nurse) AddCheck added in v1.1.0

func (n *Nurse) AddCheck(reason string, checkFunc CheckFunc)

func (*Nurse) Close added in v1.1.0

func (n *Nurse) Close() error

func (*Nurse) GatherVitals added in v1.1.0

func (n *Nurse) GatherVitals(reason string, meta Meta)

func (*Nurse) Start added in v1.1.0

func (n *Nurse) Start() error

type State

type State struct {
	// contains filtered or unexported fields
}

type Status

type Status string
const (
	StatusPassing Status = "passing"
	StatusFailing Status = "failing"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL