prober

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: Apache-2.0 Imports: 9 Imported by: 10

Documentation

Index

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) IsHealthy

func (p *Prober) IsHealthy() error

IsHealthy returns error if component is not healthy and nil if it is.

func (*Prober) IsReady

func (p *Prober) IsReady() error

IsReady returns error if component is not ready and nil otherwise.

func (*Prober) RegisterInMux

func (p *Prober) RegisterInMux(mux *http.ServeMux)

RegisterInMux registers readiness and liveness probes to mux.

func (*Prober) RegisterInRouter

func (p *Prober) RegisterInRouter(router *route.Router)

RegisterInRouter registers readiness and liveness probes to router.

func (*Prober) SetHealthy

func (p *Prober) SetHealthy()

SetHealthy sets components status to healthy.

func (*Prober) SetNotHealthy

func (p *Prober) SetNotHealthy(err error)

SetNotHealthy sets components status to not healthy with given error as a cause.

func (*Prober) SetNotReady

func (p *Prober) SetNotReady(err error)

SetNotReady sets components status to not ready with given error as a cause.

func (*Prober) SetReady

func (p *Prober) SetReady()

SetReady sets components status to ready.

Jump to

Keyboard shortcuts

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