health

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAlreadyStarted is returned when the Monitor has alreadybeen started
	ErrAlreadyStarted = fmt.Errorf("monitor already started")
)

Functions

func HandlerFunc added in v0.0.3

func HandlerFunc(monitor *Monitor) http.HandlerFunc

HandlerFunc returns an http.HandlerFunc for users to register with their system.

Types

type Monitor

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

Monitor is process used to manage the registered checks. It's responsible for consolidating all check reports from each check and broadcasting them out to subscribers.

func NewMonitor

func NewMonitor(checks ...check.Check) *Monitor

NewMonitor constructs and returns a monitor capable of observing the provided set of checks. Monitors must be started and can be observed.

func (*Monitor) Report

func (m *Monitor) Report() report.Report

Report returns a summary of information regarding the current systems health.

func (*Monitor) SetClock

func (m *Monitor) SetClock(clock clockwork.Clock) error

SetClock updates the internal clock used by the system. This must be called before the system is started. Once started, the clock cannot be changed.

func (*Monitor) Start

func (m *Monitor) Start(ctx context.Context) error

Start initiates all check watches.

func (*Monitor) Subscribe

func (m *Monitor) Subscribe() (chan check.Report, UnsubFunc)

Subscribe returns a channel that buffers reports for subscribers to respond to. A report who has no check specified represents a change in overall system health.

type UnsubFunc

type UnsubFunc = func()

UnsubFunc defines a function call that stops the subscription process.

Jump to

Keyboard shortcuts

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