prober

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCProbe added in v0.11.0

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

GRPCProbe represents health and readiness status of given component, and provides GRPC integration.

func NewGRPC added in v0.11.0

func NewGRPC() *GRPCProbe

NewGRPC creates a Probe that wrapped around grpc/healt.Server which reflects status of server.

func (*GRPCProbe) HealthServer added in v0.11.0

func (p *GRPCProbe) HealthServer() *health.Server

HealthServer returns a gRPC health server which responds readiness and liveness checks.

func (*GRPCProbe) Healthy added in v0.11.0

func (p *GRPCProbe) Healthy()

Healthy sets components status to healthy.

func (*GRPCProbe) NotHealthy added in v0.11.0

func (p *GRPCProbe) NotHealthy(err error)

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

func (*GRPCProbe) NotReady added in v0.11.0

func (p *GRPCProbe) NotReady(err error)

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

func (*GRPCProbe) Ready added in v0.11.0

func (p *GRPCProbe) Ready()

Ready sets components status to ready.

type HTTPProbe added in v0.11.0

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

HTTPProbe represents health and readiness status of given component, and provides HTTP integration.

func NewHTTP added in v0.11.0

func NewHTTP() *HTTPProbe

NewHTTP returns HTTPProbe representing readiness and healthiness of given component.

func (*HTTPProbe) Healthy added in v0.11.0

func (p *HTTPProbe) Healthy()

Healthy sets components status to healthy.

func (*HTTPProbe) HealthyHandler added in v0.11.0

func (p *HTTPProbe) HealthyHandler(logger log.Logger) http.HandlerFunc

HealthyHandler returns a HTTP Handler which responds health checks.

func (*HTTPProbe) IsReady added in v0.26.0

func (p *HTTPProbe) IsReady() bool

IsReady returns true if component is ready.

func (*HTTPProbe) NotHealthy added in v0.11.0

func (p *HTTPProbe) NotHealthy(err error)

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

func (*HTTPProbe) NotReady added in v0.11.0

func (p *HTTPProbe) NotReady(err error)

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

func (*HTTPProbe) Ready added in v0.11.0

func (p *HTTPProbe) Ready()

Ready sets components status to ready.

func (*HTTPProbe) ReadyHandler added in v0.11.0

func (p *HTTPProbe) ReadyHandler(logger log.Logger) http.HandlerFunc

ReadyHandler returns a HTTP Handler which responds readiness checks.

type InstrumentationProbe added in v0.11.0

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

InstrumentationProbe stores instrumentation state of Probe. This is created with an intention to combine with other Probe's using prober.Combine.

func NewInstrumentation added in v0.11.0

func NewInstrumentation(component component.Component, logger log.Logger, reg prometheus.Registerer) *InstrumentationProbe

NewInstrumentation returns InstrumentationProbe records readiness and healthiness for given component.

func (*InstrumentationProbe) Healthy added in v0.11.0

func (p *InstrumentationProbe) Healthy()

Healthy records the component status when Healthy is called, if combined with other Probes.

func (*InstrumentationProbe) NotHealthy added in v0.11.0

func (p *InstrumentationProbe) NotHealthy(err error)

NotHealthy records the component status when NotHealthy is called, if combined with other Probes.

func (*InstrumentationProbe) NotReady added in v0.11.0

func (p *InstrumentationProbe) NotReady(err error)

NotReady records the component status when NotReady is called, if combined with other Probes.

func (*InstrumentationProbe) Ready added in v0.11.0

func (p *InstrumentationProbe) Ready()

Ready records the component status when Ready is called, if combined with other Probes.

type Probe added in v0.11.0

type Probe interface {
	Healthy()
	NotHealthy(err error)
	Ready()
	NotReady(err error)
}

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 Combine added in v0.11.0

func Combine(probes ...Probe) Probe

Combine folds given probes into one, reflects their statuses in a thread-safe way.

Jump to

Keyboard shortcuts

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