Documentation
¶
Index ¶
- Constants
- type HealthMonitor
- type ManualHealthMonitor
- func (srv *ManualHealthMonitor) Collect(c chan<- prometheus.Metric)
- func (srv *ManualHealthMonitor) Describe(c chan<- *prometheus.Desc)
- func (srv *ManualHealthMonitor) IsHealthy() (bool, string, error)
- func (srv *ManualHealthMonitor) Run(ctx context.Context, log *logrus.Entry) error
- func (srv *ManualHealthMonitor) SetHealthStatus(isHealthy bool) bool
- func (srv *ManualHealthMonitor) WithReason(reason string) *ManualHealthMonitor
- type MultiHealthMonitor
- func (srv *MultiHealthMonitor) Collect(c chan<- prometheus.Metric)
- func (srv *MultiHealthMonitor) Describe(c chan<- *prometheus.Desc)
- func (srv *MultiHealthMonitor) IsHealthy() (ok bool, reason string, err error)
- func (srv *MultiHealthMonitor) Run(ctx context.Context, log *logrus.Entry) error
- func (srv *MultiHealthMonitor) WithMetricsPrefix(v string) *MultiHealthMonitor
- func (srv *MultiHealthMonitor) WithMinimumReplicasAvailable(v int) *MultiHealthMonitor
Constants ¶
View Source
const ( 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" )UnavailableReason
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(context.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) 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
Click to show internal directories.
Click to hide internal directories.