Documentation
¶
Index ¶
- Constants
- func TelnetCheck(prefix string, checkedUrl string, health *Health)
- type Checker
- type CheckerFunc
- type CompositeChecker
- type Handler
- type Health
- func (h *Health) AddInfo(key string, value interface{}) *Health
- func (h *Health) Down() *Health
- func (h Health) GetInfo(key string) interface{}
- func (h Health) IsDown() bool
- func (h Health) IsOutOfService() bool
- func (h Health) IsUnknown() bool
- func (h Health) IsUp() bool
- func (h Health) MarshalJSON() ([]byte, error)
- func (h *Health) OutOfService() *Health
- func (h *Health) Unknown() *Health
- func (h *Health) Up() *Health
- type HealthFunc
Constants ¶
const ( UP status = "UP" DOWN = "DOWN" OUT_OF_SERVICE = "OUT OF SERVICE" UNKNOWN = "UNKNOWN" )
Variables ¶
This section is empty.
Functions ¶
func TelnetCheck ¶
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 Handler ¶
type Handler struct {
CompositeChecker
}
Handler is a HTTP Server Handler implementation
func (Handler) GinHandler ¶
ServeHTTP returns a json encoded Health set the State to http.StatusServiceUnavailable if the check is DOWN
type Health ¶
type Health struct { Status status Info map[string]interface{} }
Health is a health State struct
func (Health) IsOutOfService ¶
IsOutOfService returns true if State is IsOutOfService
func (Health) MarshalJSON ¶
MarshalJSON is a custom JSON marshaller
func (*Health) OutOfService ¶
OutOfService set the State to OutOfService
type HealthFunc ¶
type HealthFunc func() Health