Documentation ¶
Index ¶
- Constants
- func CreateHealthCheck(cfg v2.HealthCheck) types.HealthChecker
- func RegisterCommonCallbacks(name string, cb types.HealthCheckCb) bool
- func RegisterSessionFactory(p types.ProtocolName, f types.HealthCheckSessionFactory)
- type CodeRange
- type HTTPDialSession
- type HTTPDialSessionFactory
- type HttpCheckConfig
- type TCPDialSession
- type TCPDialSessionFactory
Constants ¶
View Source
const ( DefaultTimeout = time.Second DefaultInterval = 15 * time.Second DefaultIntervalJitter = 5 * time.Millisecond DefaultHealthyThreshold uint32 = 1 DefaultUnhealthyThreshold uint32 = 1 )
View Source
const (
HTTPCheckConfigKey = "http_check_config"
)
Variables ¶
This section is empty.
Functions ¶
func CreateHealthCheck ¶
func CreateHealthCheck(cfg v2.HealthCheck) types.HealthChecker
CreateHealthCheck is a extendable function that can create different health checker by different health check session. The Default session is TCPDial session
func RegisterCommonCallbacks ¶
func RegisterCommonCallbacks(name string, cb types.HealthCheckCb) bool
func RegisterSessionFactory ¶
func RegisterSessionFactory(p types.ProtocolName, f types.HealthCheckSessionFactory)
Types ¶
type HTTPDialSession ¶ added in v0.27.0
type HTTPDialSession struct { Codes []CodeRange // contains filtered or unexported fields }
func (*HTTPDialSession) CheckHealth ¶ added in v0.27.0
func (s *HTTPDialSession) CheckHealth() bool
func (*HTTPDialSession) OnTimeout ¶ added in v0.27.0
func (s *HTTPDialSession) OnTimeout()
type HTTPDialSessionFactory ¶ added in v0.27.0
type HTTPDialSessionFactory struct{}
func (*HTTPDialSessionFactory) NewSession ¶ added in v0.27.0
func (f *HTTPDialSessionFactory) NewSession(cfg map[string]interface{}, host types.Host) types.HealthCheckSession
type HttpCheckConfig ¶ added in v0.27.0
type HttpCheckConfig struct { Port int `json:"port,omitempty"` Timeout api.DurationConfig `json:"timeout,omitempty"` Path string `json:"path,omitempty"` Method string `json:"method,omitempty"` Scheme string `json:"scheme,omitempty"` Domain string `json:"domain,omitempty"` Codes []CodeRange `json:"codes,omitempty"` }
type TCPDialSession ¶
type TCPDialSession struct {
// contains filtered or unexported fields
}
func (*TCPDialSession) CheckHealth ¶
func (s *TCPDialSession) CheckHealth() bool
func (*TCPDialSession) OnTimeout ¶
func (s *TCPDialSession) OnTimeout()
type TCPDialSessionFactory ¶
type TCPDialSessionFactory struct{}
func (*TCPDialSessionFactory) NewSession ¶
func (f *TCPDialSessionFactory) NewSession(cfg map[string]interface{}, host types.Host) types.HealthCheckSession
Click to show internal directories.
Click to hide internal directories.