health

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker interface {
	Check() Health
}

Checker is a interface used to provide an indication of application health.

type CheckerFunc

type CheckerFunc func() Health

CheckerFunc is an adapter to allow the use of ordinary go functions as Checkers.

func (CheckerFunc) Check

func (f CheckerFunc) Check() Health

type CompositeChecker

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

CompositeChecker aggregate a list of Checkers

func NewCompositeChecker

func NewCompositeChecker() CompositeChecker

NewCompositeChecker creates a new CompositeChecker

func (*CompositeChecker) AddChecker

func (c *CompositeChecker) AddChecker(name string, checker Checker)

AddChecker add a Checker to the aggregator

func (*CompositeChecker) AddInfo

func (c *CompositeChecker) AddInfo(key string, value interface{}) *CompositeChecker

AddInfo adds a info value to the Info map

func (CompositeChecker) Check

func (c CompositeChecker) Check() Health

Check returns the combination of all checkers added if some check is not UP, the combined is marked as Down

type Health

type Health interface {
	Is(Status) bool
	Set(Status)

	AddInfo(key string, value interface{})
	GetInfo(key string) interface{}
}

func NewHealth

func NewHealth() Health

NewHealth return a new health with Status Down

type Status

type Status string
const (
	UP           Status = "UP"
	Down         Status = "DOWN"
	OutOfService Status = "OUT OF SERVICE"
	Unknown      Status = "UNKNOWN"
)

Jump to

Keyboard shortcuts

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