prober

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCProbe

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

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

func NewGRPC

func NewGRPC() *GRPCProbe

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

func (*GRPCProbe) HealthServer

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

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

func (*GRPCProbe) Healthy

func (p *GRPCProbe) Healthy()

Healthy sets components status to healthy.

func (*GRPCProbe) NotHealthy

func (p *GRPCProbe) NotHealthy(err error)

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

func (*GRPCProbe) NotReady

func (p *GRPCProbe) NotReady(err error)

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

func (*GRPCProbe) Ready

func (p *GRPCProbe) Ready()

Ready sets components status to ready.

type HTTPProbe

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

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

func NewHTTP

func NewHTTP() *HTTPProbe

NewHTTP returns HTTPProbe representing readiness and healthiness of given component.

func (*HTTPProbe) Healthy

func (p *HTTPProbe) Healthy()

Healthy sets components status to healthy.

func (*HTTPProbe) HealthyHandler

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

HealthyHandler returns a HTTP Handler which responds health checks.

func (*HTTPProbe) NotHealthy

func (p *HTTPProbe) NotHealthy(err error)

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

func (*HTTPProbe) NotReady

func (p *HTTPProbe) NotReady(err error)

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

func (*HTTPProbe) Ready

func (p *HTTPProbe) Ready()

Ready sets components status to ready.

func (*HTTPProbe) ReadyHandler

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

ReadyHandler returns a HTTP Handler which responds readiness checks.

type InstrumentationProbe

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

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

NewInstrumentation returns InstrumentationProbe records readiness and healthiness for given component.

func (*InstrumentationProbe) Healthy

func (p *InstrumentationProbe) Healthy()

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

func (*InstrumentationProbe) NotHealthy

func (p *InstrumentationProbe) NotHealthy(err error)

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

func (*InstrumentationProbe) NotReady

func (p *InstrumentationProbe) NotReady(err error)

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

func (*InstrumentationProbe) Ready

func (p *InstrumentationProbe) Ready()

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

type Probe

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

Probe 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

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