options

package
v2.0.0-beta2.0...-6ef21df Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

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

func CalibrateTimeout(ms int) time.Duration

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 New

func New() *Options

New returns a new Options reference with default values

func (*Options) Clone

func (o *Options) Clone() *Options

Clone returns an exact copy of a *healthcheck.Options

func (*Options) HasExpectedBody

func (o *Options) HasExpectedBody() bool

HasExpectedBody returns true if a Custom Expected Body was provided

func (*Options) Overlay

func (o *Options) Overlay(name string, custom *Options)

func (*Options) SetExpectedBody

func (o *Options) SetExpectedBody(body string)

SetExpectedBody sets the expected body

func (*Options) SetMetaData

func (o *Options) SetMetaData(md yamlx.KeyLookup)

SetMetaData sets the metadata for the health checker options

func (*Options) URL

func (o *Options) URL() *url.URL

URL returns a URL from the Options

Jump to

Keyboard shortcuts

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