Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLimitReached = errors.New("the read limit is reached")
ErrLimitReached means that the read limit is reached.
Functions ¶
This section is empty.
Types ¶
type ExecProber ¶
type ExecProber interface { // Probe executes a command to check a service status. // // If the process terminates with any exit code besides 0, Failure will be returned. // The merged result of stdout + stderr are returned as output. Probe(ctx context.Context, name string, args ...string) (Result, string, error) }
ExecProber executes a command to check a service status.
type HTTPGetProber ¶
type HTTPGetProber interface { // Probe executes an HTTP GET request to determine service status. // // Any non-successful status code (< 200 or >= 400) or HTTP/network communication error will return Failure. // A potentially truncated version of the HTTP response body is returned as output. Probe(ctx context.Context, url *url.URL, headers http.Header) (Result, string, error) }
HTTPGetProber executes HTTP GET requests to determine service status.
func NewHTTPGetProber ¶
func NewHTTPGetProber() HTTPGetProber
NewHTTPGetProber creates a HTTPGetProber that will perform an HTTP GET request to determine service status.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager creates standardized Prober instances from shared instances of underlying implementations for common probe types.
func NewManager ¶
func NewManager() *Manager
NewManager creates a Manager instance to create standard Prober types.
func (*Manager) Exec ¶
func (m *Manager) Exec(name string, args ...string) ProberFunc
Exec returns a ProberFunc that performs exec probes for a specific command.
type Prober ¶
type Prober interface { // Probe executes a single status check. // // result is the current service status // output is optional info from the probe (such as a process stdout or HTTP response) // err indicates an issue with the probe itself and that the result should be ignored Probe(ctx context.Context) (result Result, output string, err error) }
Prober performs a check to determine a service status.
type ProberFunc ¶
ProberFunc is a functional version of Prober.
type Result ¶
type Result string
Result is a string used to indicate service status.
const ( // Success indicates that the service is healthy. Success Result = "success" // Warning indicates that the service is healthy but additional diagnostic information might be attached. Warning Result = "warning" // Failure indicates that the service is not healthy. Failure Result = "failure" // Unknown indicates that the prober was unable to determine the service status due to an internal issue. // // An Unknown result should also include an error in the Prober return values. Unknown Result = "unknown" )
type TCPSocketProber ¶
type TCPSocketProber interface { // Probe establishes a TCP socket to determine service status. // // Any error establishing the TCP connection will return Failure. // In the event of inability to establish a TCP connection, the output will include error information. // Successful TCP connections will result in no output returned. Probe(ctx context.Context, host string, port int) (Result, string, error) }
TCPSocketProber establishes a TCP socket to determine service status.
func NewTCPSocketProber ¶
func NewTCPSocketProber() TCPSocketProber
NewTCPSocketProber creates a TCPSocketProber that checks connectivity to a given address to determine service status.