Documentation ¶
Overview ¶
Package probe contains utilities for health probing, as well as health status information.
Index ¶
- Constants
- type ResultFunc
- type Worker
- type WorkerOption
- func WorkerFailureThreshold(v int) WorkerOption
- func WorkerInitialDelay(delay time.Duration) WorkerOption
- func WorkerOnProbeResult(f ResultFunc) WorkerOption
- func WorkerPeriod(period time.Duration) WorkerOption
- func WorkerSuccessThreshold(v int) WorkerOption
- func WorkerTimeout(timeout time.Duration) WorkerOption
Constants ¶
const ( // DefaultProbePeriod is the default value for the interval between // probe invocations. DefaultProbePeriod = 10 * time.Second // DefaultProbeTimeout is the default value for the timeout when // executing a probe to cancel it and consider it failed. DefaultProbeTimeout = 1 * time.Second // DefaultInitialDelay is the default value for the initial delay // before beginning to invoke the probe after the Worker is started. DefaultInitialDelay = 0 * time.Second // DefaultProbeSuccessThreshold is the default value for the // minimum number of consecutive successes required after having // failed before the status will transition to probe.Success. DefaultProbeSuccessThreshold = 1 // DefaultProbeFailureThreshold is the default value for the // minimum number of consecutive failures required after having // succeeded before the status will transition to probe.Failure. DefaultProbeFailureThreshold = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResultFunc ¶ added in v0.2.0
ResultFunc is invoked on every probe execution using WorkerOnProbeResult.
If statusChanged is true, the probe has transitioned. Note that subsequent invocations of ResultFunc might have the same result value but statusChanged set to false if a transition hasn't occurred due to success and failure thresholds.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker handles executing probes and reporting results.
It's loosely based (but simplified) on the k8s.io/kubernetes/pkg/kubelet/prober design.
func NewWorker ¶
func NewWorker(p prober.Prober, opts ...WorkerOption) *Worker
NewWorker creates a Worker instance using the provided probe.Prober and options (if any).
type WorkerOption ¶
type WorkerOption func(w *Worker)
WorkerOption can be passed when creating a Worker to configure the instance.
func WorkerFailureThreshold ¶
func WorkerFailureThreshold(v int) WorkerOption
WorkerFailureThreshold sets the number of consecutive failures required after a probe has succeeded before the status will transition to probe.Failure.
func WorkerInitialDelay ¶
func WorkerInitialDelay(delay time.Duration) WorkerOption
WorkerInitialDelay sets the amount of time that will be waited when the prober starts before beginning to invoke the probe.
The status will be probe.Failure during the initial delay period.
func WorkerOnProbeResult ¶ added in v0.2.0
func WorkerOnProbeResult(f ResultFunc) WorkerOption
WorkerOnProbeResult sets the function to invoke after every probe execution regardless of whether it results in a status transition.
func WorkerPeriod ¶
func WorkerPeriod(period time.Duration) WorkerOption
WorkerPeriod sets the period between probe invocations.
func WorkerSuccessThreshold ¶
func WorkerSuccessThreshold(v int) WorkerOption
WorkerSuccessThreshold sets the number of consecutive successes required after a probe has failed before the status will transition to probe.Success.
func WorkerTimeout ¶
func WorkerTimeout(timeout time.Duration) WorkerOption
WorkerTimeout sets the duration before a running probe is canceled and considered to have failed.