Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultHealthCheckPath is the default value (noop) for Backends' Health Check Path DefaultHealthCheckPath = "/" // DefaultHealthCheckQuery is the default value (noop) for Backends' Health Check Query Parameters DefaultHealthCheckQuery = "" // DefaultHealthCheckVerb is the default value (noop) for Backends' Health Check Verb DefaultHealthCheckVerb = http.MethodGet // DefaultHealthCheckTimeoutMS is the default duration for health check probes to wait before timing out DefaultHealthCheckTimeoutMS = 3000 // DefaultHealthCheckRecoveryThreshold defines the default number of successful health checks // following failure to indicate true recovery DefaultHealthCheckRecoveryThreshold = 3 // DefaultHealthCheckFailureThreshold defines the default number of failed health checks // following recovery or initial healthy to indicate true recovery DefaultHealthCheckFailureThreshold = 3 )
View Source
const MaxProbeWaitMS = 30000
MaxProbeWaitMS is the maximum time a health check will wait before timing out
View Source
const MinProbeWaitMS = 100
MinProbeWaitMS is the minimum time a health check will wait before timing out
Variables ¶
View Source
var ErrNoOptionsProvided = errors.New("no health check options provided")
ErrNoOptionsProvided returns an error for no health check options provided
Functions ¶
func CalibrateTimeout ¶
CalibrateTimeout returns a time.Duration representing a calibrated timeout value based on the milliseconds of duration provided
Types ¶
type Options ¶
type Options struct { // IntervalMS defines the interval in milliseconds at which the target will be probed IntervalMS int `yaml:"interval_ms,omitempty"` // FailureThreshold indicates the number of consecutive failed probes required to // mark an available target as unavailable FailureThreshold int `yaml:"failure_threshold,omitempty"` // RecoveryThreshold indicates the number of consecutive successful probes required to // mark an unavailable target as available RecoveryThreshold int `yaml:"recovery_threshold,omitempty"` // Target Outbound Request Options // Verb provides the HTTP verb to use when making an upstream health check Verb string `yaml:"verb,omitempty"` // Scheme is the scheme to use when making an upstream health check (http or https) Scheme string `yaml:"scheme,omitempty"` // Host is the Host name header to use when making an upstream health check Host string `yaml:"host,omitempty"` // Path provides the URL path for the upstream health check Path string `yaml:"path,omitempty"` // Query provides the HTTP query parameters to use when making an upstream health check Query string `yaml:"query,omitempty"` // Headers provides the HTTP Headers to apply when making an upstream health check Headers map[string]string `yaml:"headers,omitempty"` // Body provides a body to apply when making an upstream health check request Body string `yaml:"body,omitempty"` // TimeoutMS is the amount of time a health check probe should wait for a response // before timing out TimeoutMS int `yaml:"timeout_ms,omitempty"` // Target Probe Response Options // ExpectedCodes is the list of Status Codes that positively indicate a Healthy status ExpectedCodes []int `yaml:"expected_codes,omitempty"` // ExpectedHeaders is a list of Headers (name and value) expected in the response // in order to be considered Healthy status ExpectedHeaders map[string]string `yaml:"expected_headers,omitempty"` // ExpectedBody is the body expected in the response to be considered Healthy status ExpectedBody string `yaml:"expected_body,omitempty"` // contains filtered or unexported fields }
Options defines Health Checking Options
func (*Options) HasExpectedBody ¶
HasExpectedBody returns true if a Custom Expected Body was provided
func (*Options) SetExpectedBody ¶
SetExpectedBody sets the expected body
func (*Options) SetMetaData ¶
SetMetaData sets the metadata for the health checker options
Click to show internal directories.
Click to hide internal directories.