Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct { lock.RWMutex // protects staleProbes and probeStartTime // contains filtered or unexported fields }
Collector concurrently runs probes used to check status of various subsystems
func NewCollector ¶
NewCollector creates a collector and starts the given probes.
Each probe runs in a separate goroutine.
func (*Collector) Close ¶
func (c *Collector) Close()
Close exits all probes and shuts down the collector TODO(brb): call it when daemon exits (after GH#6248).
func (*Collector) GetStaleProbes ¶
GetStaleProbes returns a map of stale probes which key is a probe name and value is a time when the last instance of the probe has been started.
A probe is declared stale if it hasn't returned in FailureThreshold.
type Config ¶
type Config struct { WarningThreshold time.Duration FailureThreshold time.Duration Interval time.Duration }
Config is the collector configuration
type Probe ¶
type Probe struct { Name string Probe func(ctx context.Context) (interface{}, error) // OnStatusUpdate is called whenever the status of the probe changes OnStatusUpdate func(status Status) // Interval allows to specify a probe specific interval that can be // mutated based on whether the probe is failing or based on external // factors such as current cluster size Interval func(failures int) time.Duration // contains filtered or unexported fields }
Probe is run by the collector at a particular interval between invocations
type Status ¶
type Status struct { // Data is non-nil when the probe has completed successfully. Data is // set to the value returned by Probe() Data interface{} // Err is non-nil if either the probe file or the Failure or Warning // threshold has been reached Err error // StaleWarning is true once the WarningThreshold has been reached StaleWarning bool }
Status is passed to a probe when its state changes