Documentation ¶
Index ¶
- type Prober
- func (p *Prober) HandleIfReady(f http.HandlerFunc) http.HandlerFunc
- func (p *Prober) IsHealthy() error
- func (p *Prober) IsReady() error
- func (p *Prober) RegisterInMux(mux *http.ServeMux)
- func (p *Prober) RegisterInRouter(router *route.Router)
- func (p *Prober) SetHealthy()
- func (p *Prober) SetNotHealthy(err error)
- func (p *Prober) SetNotReady(err error)
- func (p *Prober) SetReady()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Prober ¶
type Prober struct {
// contains filtered or unexported fields
}
Prober represents health and readiness status of given component.
From Kubernetes documentation https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/ :
liveness: Many applications running for long periods of time eventually transition to broken states, (healthy) and cannot recover except by being restarted. Kubernetes provides liveness probes to detect and remedy such situations. readiness: Sometimes, applications are temporarily unable to serve traffic. (ready) For example, an application might need to load large data or configuration files during startup, or depend on external services after startup. In such cases, you don’t want to kill the application, but you don’t want to send it requests either. Kubernetes provides readiness probes to detect and mitigate these situations. A pod with containers reporting that they are not ready does not receive traffic through Kubernetes Services.
func NewProber ¶
func NewProber(component component.Component, logger log.Logger, reg prometheus.Registerer) *Prober
NewProber returns Prober representing readiness and healthiness of given component.
func (*Prober) HandleIfReady ¶
func (p *Prober) HandleIfReady(f http.HandlerFunc) http.HandlerFunc
HandleIfReady if probe is ready calls the function otherwise returns 503.
func (*Prober) RegisterInMux ¶
RegisterInMux registers readiness and liveness probes to mux.
func (*Prober) RegisterInRouter ¶
RegisterInRouter registers readiness and liveness probes to router.
func (*Prober) SetHealthy ¶
func (p *Prober) SetHealthy()
SetHealthy sets components status to healthy.
func (*Prober) SetNotHealthy ¶
SetNotHealthy sets components status to not healthy with given error as a cause.
func (*Prober) SetNotReady ¶
SetNotReady sets components status to not ready with given error as a cause.