healthmonitor

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Health check failure reason indicating the monitored component is unavailable (e.g., due to time-out).
	UnavailableReason string = "unavailable"
	// Health check failure reason indicating too many replicas have timed out.
	InsufficientReplicasAvailableReason string = "insufficientReplicasAvailable"
	// Health check failure reason indicating a component is manually disabled.
	ManuallyDisabledReason string = "manuallyDisabled"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthMonitor

type HealthMonitor interface {
	prometheus.Collector
	// IsHealthy performs a health check,
	// returning the result, a reason (should be empty if successful), and possibly an error.
	IsHealthy() (ok bool, reason string, err error)
	// Run initialises and starts the health checker.
	// Run may be blocking and should be run within a separate goroutine.
	// Must be called before IsHealthy() or any prometheus.Collector interface methods.
	Run(*armadacontext.Context, *logrus.Entry) error
}

HealthMonitor represents a health checker.

type ManualHealthMonitor

type ManualHealthMonitor struct {
	// contains filtered or unexported fields
}

ManualHealthMonitor is a manually controlled health monitor.

func NewManualHealthMonitor

func NewManualHealthMonitor() *ManualHealthMonitor

func (*ManualHealthMonitor) Collect

func (srv *ManualHealthMonitor) Collect(c chan<- prometheus.Metric)

func (*ManualHealthMonitor) Describe

func (srv *ManualHealthMonitor) Describe(c chan<- *prometheus.Desc)

func (*ManualHealthMonitor) IsHealthy

func (srv *ManualHealthMonitor) IsHealthy() (bool, string, error)

func (*ManualHealthMonitor) Run

func (*ManualHealthMonitor) SetHealthStatus

func (srv *ManualHealthMonitor) SetHealthStatus(isHealthy bool) bool

func (*ManualHealthMonitor) WithReason

func (srv *ManualHealthMonitor) WithReason(reason string) *ManualHealthMonitor

type MultiHealthMonitor

type MultiHealthMonitor struct {
	// contains filtered or unexported fields
}

MultiHealthMonitor wraps multiple HealthMonitors and itself implements the HealthMonitor interface.

func NewMultiHealthMonitor

func NewMultiHealthMonitor(name string, healthMonitorsByName map[string]HealthMonitor) *MultiHealthMonitor

func (*MultiHealthMonitor) Collect

func (srv *MultiHealthMonitor) Collect(c chan<- prometheus.Metric)

func (*MultiHealthMonitor) Describe

func (srv *MultiHealthMonitor) Describe(c chan<- *prometheus.Desc)

func (*MultiHealthMonitor) IsHealthy

func (srv *MultiHealthMonitor) IsHealthy() (ok bool, reason string, err error)

IsHealthy returns false if either 1. any child is unhealthy for a reason other than timeout or 2. at least len(healthMonitorsByName) - minReplicasAvailable + 1 children have timed out.

func (*MultiHealthMonitor) Run

Run initialises prometheus metrics and starts any child health checkers.

func (*MultiHealthMonitor) WithMetricsPrefix

func (srv *MultiHealthMonitor) WithMetricsPrefix(v string) *MultiHealthMonitor

WithMetricsPrefix adds a prefix to exported Prometheus metrics. Must be called before Describe or Collect.

func (*MultiHealthMonitor) WithMinimumReplicasAvailable

func (srv *MultiHealthMonitor) WithMinimumReplicasAvailable(v int) *MultiHealthMonitor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL