healthcheck

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 19 Imported by: 5

Documentation

Index

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 an 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

Types

type CodeRange added in v1.0.0

type CodeRange struct {
	Start int
	End   int
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL