Documentation ¶
Index ¶
Constants ¶
const PlatformsIndicatorName = "platforms"
PlatformsIndicatorName is the name of platforms indicator
const StorageIndicatorName = "storage"
StorageIndicatorName is the name of storage indicator
Variables ¶
var MinInterval = 10 * time.Second
MinInterval is the minimum check interval for a indicator configuration
Functions ¶
Types ¶
type Health ¶
type Health struct { Status Status `json:"status"` Details map[string]interface{} `json:"details,omitempty"` }
Health contains information about the health of a component.
func (*Health) WithDetail ¶
WithDetail adds a detail to the health
func (*Health) WithDetails ¶
WithDetails adds the given details to the health
func (*Health) WithStatus ¶
WithStatus sets the status of the health
type Indicator ¶
type Indicator interface { // Name returns the name of the component Name() string // Status returns the health information of the component Status() (interface{}, error) }
Indicator is an interface to provide the health of a component
type IndicatorSettings ¶ added in v0.5.0
type IndicatorSettings struct { Fatal bool `mapstructure:"fatal" description:"if the indicator affects the overall status, if false not failures_threshold expected"` FailuresThreshold int64 `mapstructure:"failures_threshold" description:"number of failures in a row that will affect overall status"` Interval time.Duration `mapstructure:"interval" description:"time between health checks of components"` }
IndicatorSettings type to be loaded from the environment
func DefaultIndicatorSettings ¶ added in v0.5.0
func DefaultIndicatorSettings() *IndicatorSettings
DefaultIndicatorSettings returns default values for indicator settings
func (*IndicatorSettings) Validate ¶ added in v0.5.0
func (is *IndicatorSettings) Validate() error
Validate validates indicator settings
type Registry ¶
type Registry struct { // HealthIndicators are the currently registered health indicators HealthIndicators []Indicator }
Registry is a struct to store health indicators
func NewDefaultRegistry ¶
func NewDefaultRegistry() *Registry
NewDefaultRegistry returns a default empty health registry
func (*Registry) SetIndicator ¶ added in v0.6.0
SetIndicator adds or replaces existing indicator with same name in registry
type Settings ¶ added in v0.5.0
type Settings struct {
Indicators map[string]*IndicatorSettings `mapstructure:"indicators"`
}
Settings type to be loaded from the environment
func DefaultSettings ¶ added in v0.5.0
func DefaultSettings() *Settings
DefaultSettings returns default values for health settings
type Status ¶
type Status string
Status represents the overall health status of a component
const ( // StatusUp indicates that the checked component is up and running StatusUp Status = "UP" // StatusDown indicates the the checked component has an issue and is unavailable StatusDown Status = "DOWN" // StatusUnknown indicates that the health of the checked component cannot be determined StatusUnknown Status = "UNKNOWN" )
type StatusListener ¶ added in v0.5.0
type StatusListener struct{}
func (*StatusListener) HealthCheckFailed ¶ added in v0.5.0
func (sl *StatusListener) HealthCheckFailed(state *health.State)
func (*StatusListener) HealthCheckRecovered ¶ added in v0.5.0
func (sl *StatusListener) HealthCheckRecovered(state *health.State, numberOfFailures int64, unavailableDuration float64)