Documentation
¶
Index ¶
- type CheckInfo
- type CheckManager
- func (m *CheckManager) Checks() ([]*CheckInfo, error)
- func (m *CheckManager) Ensure() error
- func (m *CheckManager) NotifyCheckFailed(f FailureFunc)
- func (m *CheckManager) PlanChanged(newPlan *plan.Plan)
- func (m *CheckManager) RefreshCheck(ctx context.Context, check *plan.Check) (*CheckInfo, error)
- func (m *CheckManager) Replan()
- func (m *CheckManager) StartChecks(checks []string) (started []string, err error)
- func (m *CheckManager) StopChecks(checks []string) (stopped []string, err error)
- func (m *CheckManager) WriteMetrics(writer metrics.Writer) error
- type CheckStatus
- type ChecksNotFound
- type FailureFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckInfo ¶
type CheckInfo struct {
Name string
Level plan.CheckLevel
Startup plan.CheckStartup
Status CheckStatus
Successes int
Failures int
Threshold int
ChangeID string
PrevChangeID string
}
CheckInfo provides status information about a single check.
type CheckManager ¶
type CheckManager struct {
// contains filtered or unexported fields
}
CheckManager starts and manages the health checks.
func NewManager ¶
func NewManager(s *state.State, runner *state.TaskRunner, planMgr *planstate.PlanManager) *CheckManager
NewManager creates a new check manager.
func (*CheckManager) Checks ¶
func (m *CheckManager) Checks() ([]*CheckInfo, error)
Checks returns the list of currently-configured checks and their status, ordered by name.
func (*CheckManager) Ensure ¶ added in v1.11.0
func (m *CheckManager) Ensure() error
func (*CheckManager) NotifyCheckFailed ¶
func (m *CheckManager) NotifyCheckFailed(f FailureFunc)
NotifyCheckFailed adds f to the list of functions that are called whenever a check hits its failure threshold.
func (*CheckManager) PlanChanged ¶
func (m *CheckManager) PlanChanged(newPlan *plan.Plan)
PlanChanged handles updates to the plan (server configuration), stopping the previous checks and starting the new ones as required.
func (*CheckManager) RefreshCheck ¶ added in v1.20.0
RefreshCheck runs a check immediately.
func (*CheckManager) Replan ¶ added in v1.19.0
func (m *CheckManager) Replan()
Replan handles starting "startup: enabled" checks when a replan occurs. Checks that are "startup: disabled" but are already running do not get stopped in a replan. The state lock must be held when calling this method.
func (*CheckManager) StartChecks ¶ added in v1.19.0
func (m *CheckManager) StartChecks(checks []string) (started []string, err error)
StartChecks starts the checks with the specified names, if not already running, and returns the checks that did need to be started.
func (*CheckManager) StopChecks ¶ added in v1.19.0
func (m *CheckManager) StopChecks(checks []string) (stopped []string, err error)
StopChecks stops the checks with the specified names, if currently running, and returns the checks that did need to be stopped.
func (*CheckManager) WriteMetrics ¶ added in v1.19.0
func (m *CheckManager) WriteMetrics(writer metrics.Writer) error
WriteMetrics collects and writes metrics for all checks to the provided writer.
type CheckStatus ¶
type CheckStatus string
const ( CheckStatusUp CheckStatus = "up" CheckStatusDown CheckStatus = "down" CheckStatusInactive CheckStatus = "inactive" )
type ChecksNotFound ¶ added in v1.19.0
type ChecksNotFound struct {
Names []string
}
ChecksNotFound is the error returned by StartChecks or StopChecks when a check with the specified name is not found in the plan.
func (*ChecksNotFound) Error ¶ added in v1.19.0
func (e *ChecksNotFound) Error() string
type FailureFunc ¶
type FailureFunc func(name string)
FailureFunc is the type of function called when a failure action is triggered.