Documentation
¶
Index ¶
Constants ¶
const DefaultHeartbeatsPerTTL = 3
DefaultHeartbeatsPerTTL default number of heartbeats per TTL
const DefaultReregistrationDelay = time.Duration(5) * time.Second
DefaultReregistrationDelay default delay before registering
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPHealthCheck ¶ added in v0.4.0
type HTTPHealthCheck struct {
// contains filtered or unexported fields
}
HTTPHealthCheck performs periodic HTTP health checks.
func NewHTTPHealthCheck ¶ added in v0.4.0
func NewHTTPHealthCheck(conf config.HealthCheck) (*HTTPHealthCheck, error)
NewHTTPHealthCheck creates a new HTTP health check from the given configuration
func (*HTTPHealthCheck) Start ¶ added in v0.4.0
func (c *HTTPHealthCheck) Start(statusChan chan HealthStatus)
Start HTTP health check.
func (*HTTPHealthCheck) Stop ¶ added in v0.4.0
func (c *HTTPHealthCheck) Stop()
Stop HTTP health check.
type HealthCheck ¶ added in v0.4.0
type HealthCheck interface {
Start(statusChan chan HealthStatus)
Stop()
}
HealthCheck is an interface for performing a health check.
func BuildHealthCheck ¶ added in v0.4.0
func BuildHealthCheck(checkConf config.HealthCheck) (HealthCheck, error)
BuildHealthCheck builds a HealthCheck out of the given health check configuration
func BuildHealthChecks ¶ added in v0.4.0
func BuildHealthChecks(checkConfs []config.HealthCheck) ([]HealthCheck, error)
BuildHealthChecks constructs health checks.
type HealthChecker ¶ added in v0.4.0
type HealthChecker struct {
// contains filtered or unexported fields
}
HealthChecker uses a collection of periodic health checks to manage registration. Registration is maintained while the state of the health checker is healthy. If the state changes to unhealthy, the registration agent is stopped. Similarly, if the state changes to healthy, the registration agent is started again. If any health check's last reported status is unhealthy, the health checker is considered unhealthy.
func NewHealthChecker ¶ added in v0.4.0
func NewHealthChecker(registration *RegistrationAgent, checks []HealthCheck) *HealthChecker
NewHealthChecker instantiates a health checker.
type HealthStatus ¶ added in v0.4.0
type HealthStatus struct {
HealthCheck HealthCheck
Error error
}
HealthStatus is the reported health status reported by a health check.
type RegistrationAgent ¶
type RegistrationAgent struct {
// contains filtered or unexported fields
}
RegistrationAgent maintains a registration with registry.
func NewRegistrationAgent ¶
func NewRegistrationAgent(config RegistrationConfig) (*RegistrationAgent, error)
NewRegistrationAgent instantiates a new instance of the agent
func (*RegistrationAgent) Start ¶
func (agent *RegistrationAgent) Start()
Start maintaining registration with registry. Non-blocking.
func (*RegistrationAgent) Stop ¶
func (agent *RegistrationAgent) Stop()
Stop maintaining registration with registry.
type RegistrationConfig ¶
type RegistrationConfig struct {
Client client.Client
ServiceInstance *client.ServiceInstance
}
RegistrationConfig options