Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultHTTPHealthCheckProvider = &HTTPHealthCheckProvider{}
DefaultHTTPHealthCheckProvider holds a http health monitoring provider.
var DefaultHTTPSHealthCheckProvider = &HTTPHealthCheckProvider{ HTTPS: true, }
var DefaultNoneHealthCheckProvider = &NoneHealthCheckProvider{}
DefaultNoneHealthCheckProvider defines a nop-healthcheck provider which always returns "up".
var DefaultTCPHealthCheckProvider = &TCPHealthCheckProvider{}
DefaultTCPHealthCheckProvider holds a tcp health monitoring provider.
Functions ¶
This section is empty.
Types ¶
type HTTPHealthCheckProvider ¶
HTTPHealthCheckProvider represents a HealthCheckProvider which monitors a http endpoint.
func NewHTTPHealthCheckProvider ¶
func NewHTTPHealthCheckProvider(https bool, insecureSkipVerify bool, path string) *HTTPHealthCheckProvider
func (*HTTPHealthCheckProvider) CheckHealth ¶
func (c *HTTPHealthCheckProvider) CheckHealth(h *HealthCheck) (string, bool)
CheckHealth validates whether the current endpoint is up
type HealthCheck ¶
type HealthCheck struct { IP net.IP Port int Provider HealthCheckProvider Healthy bool LastTimeHealthy time.Time LastCheck time.Time LastMessage string PlannedRetention time.Duration Retention time.Duration MaxRetention time.Duration MaxResponseTime time.Duration }
HealthCheck represents a health monitoring resource
func NewHealthCheck ¶
func NewHealthCheck( ip net.IP, port int, provider HealthCheckProvider, plannedRetention time.Duration, maxRetention time.Duration, maxResponseTime time.Duration, ) *HealthCheck
NewHealthCheck creates a new HealthCheck instance with the specified parameters.
func (*HealthCheck) CheckHealth ¶
func (h *HealthCheck) CheckHealth()
CheckHealth updates the current HealthCheck (e.g. the healthy-property)
func (*HealthCheck) GetAddress ¶
func (h *HealthCheck) GetAddress() string
GetAddress returns the endpoint (i.e. 127.0.0.1:80) of the current HealthCheck.
func (*HealthCheck) Monitor ¶
func (h *HealthCheck) Monitor(stopChan chan struct{}) chan HealthCheckStatus
Monitor starts monitoring the endpoint configured in the HealthCheck.
type HealthCheckProvider ¶
type HealthCheckProvider interface {
CheckHealth(healthCheck *HealthCheck) (string, bool)
}
HealthCheckProvider defines any implementation of the CheckHealth func
func GetHealthCheckProvider ¶
func GetHealthCheckProvider(name string) (HealthCheckProvider, error)
type HealthCheckStatus ¶
HealthCheckStatus represents the current status of a HealthCheck endpoint.
func (HealthCheckStatus) GetAddress ¶
func (h HealthCheckStatus) GetAddress() string
GetAddress returns the endpoint (i.e. 127.0.0.1:80) of the current HealthCheckStatus.
func (HealthCheckStatus) String ¶
func (s HealthCheckStatus) String() string
String returns a string representation of the current status.
type NoneHealthCheckProvider ¶
type NoneHealthCheckProvider struct { }
NoneHealthCheckProvider is a dummy provider which does no checking at all and always returns "up"
func (*NoneHealthCheckProvider) CheckHealth ¶
func (c *NoneHealthCheckProvider) CheckHealth(h *HealthCheck) (string, bool)
CheckHealth with the none-provider always returns "up" for the current service.
type TCPHealthCheckProvider ¶
type TCPHealthCheckProvider struct { }
TCPHealthCheckProvider represents a HealthCheckProvider which monitors a tcp endpoint.
func (*TCPHealthCheckProvider) CheckHealth ¶
func (c *TCPHealthCheckProvider) CheckHealth(h *HealthCheck) (string, bool)
CheckHealth validates whether the current endpoint is up