Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatal ¶
Fatal wraps the supplied error to indicate that it is fatal. When a check returns a fatal error retry execution will be aborted.
func SetContextMetadata ¶ added in v0.4.0
SetContextMetadata stores the supplied Metadata in the context.
Types ¶
type CallbackFunc ¶
CallbackFunc represents an execution callback function. The function is invoked on each health check invocation.
type HTTPCheck ¶
type HTTPCheck struct {
// contains filtered or unexported fields
}
HTTPCheck represents an HTTP health check.
func (*HTTPCheck) Healthy ¶
Healthy returns true if the target URL returns the expected status code.
type Metadata ¶ added in v0.4.0
Metadata represents check metadata.
func GetContextMetadata ¶ added in v0.4.0
GetContextMetadata returns the Metadata stored in the .
type MetadataCheck ¶ added in v0.4.0
Metadata represents a check that has metadata.
func File ¶
func File(path string) MetadataCheck
File returns a file health check. The check returns nil if the file exists.
func WithMetadata ¶ added in v0.4.0
func WithMetadata(fn CheckFunc, pairs ...any) MetadataCheck
WithMetadata wraps the CheckFunc with the supplied metadata. Metadata should be specified in key/value pairs. The function will panic if the pairs are invalid.
type Option ¶
type Option func(*options)
Option represents an execution option.
func JoinOptions ¶ added in v0.4.2
JoinOptions joins the specified options to simplify re-use.
func WithCallback ¶
func WithCallback(fn CallbackFunc) Option
WithCallback specifies the callback function to be invoked after check execution.
func WithContext ¶
WithContext uses the supplied context for check execution. This allows alternative context cancellations to be specified.
func WithDelay ¶
WithDelay specifies the retry delay between check executions. The default value is one second.
func WithJitter ¶
WithJitter specifies an optional maximum jitter to apply to the delay. The default value is no jitter.
func WithTimeout ¶
WithTimeout specifies the retry execution timeout. Retry execution will be cancelled either on the cancellation of a supplied context or after the timeout has elapsed. The default value is 30 seconds.
type TCPCheck ¶
type TCPCheck struct {
// contains filtered or unexported fields
}
TCPCheck represents a TCP health check.
func (*TCPCheck) Healthy ¶
Healtyh returns nil if a TCP connection can be established with the target address.