health

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package health implements functionality for readiness and liveness health probes. The probes are served by an HTTP server that exposes HTTP paths to probe on, with this package providing the necessary HTTP handlers to respond to probe requests.

Package health is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LivenessHandler

func LivenessHandler(probes []Probes, urlProbes []HTTPProbe) http.Handler

LivenessHandler returns liveness http handlers for health

func ReadinessHandler

func ReadinessHandler(probes []Probes, urlProbes []HTTPProbe) http.Handler

ReadinessHandler returns readiness http handlers for health

func SimpleHandler added in v1.2.0

func SimpleHandler(w http.ResponseWriter, _ *http.Request)

SimpleHandler returns a simple http handler for health checks.

Types

type HTTPProbe added in v0.4.0

type HTTPProbe struct {
	URL      string
	Protocol ProtocolType
}

HTTPProbe is a type used to represent an HTTP or HTTPS probe

func (HTTPProbe) Probe added in v0.4.0

func (httpProbe HTTPProbe) Probe() (int, error)

Probe sends an HTTP or HTTPS probe for the given probe request. Certificate verification is skipped for HTTPS probes.

type MockProbes added in v0.4.0

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

MockProbes is a mock of Probes interface.

func NewMockProbes added in v0.4.0

func NewMockProbes(ctrl *gomock.Controller) *MockProbes

NewMockProbes creates a new mock instance.

func (*MockProbes) EXPECT added in v0.4.0

func (m *MockProbes) EXPECT() *MockProbesMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockProbes) GetID added in v0.4.0

func (m *MockProbes) GetID() string

GetID mocks base method.

func (*MockProbes) Liveness added in v0.4.0

func (m *MockProbes) Liveness() bool

Liveness mocks base method.

func (*MockProbes) Readiness added in v0.4.0

func (m *MockProbes) Readiness() bool

Readiness mocks base method.

type MockProbesMockRecorder added in v0.4.0

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

MockProbesMockRecorder is the mock recorder for MockProbes.

func (*MockProbesMockRecorder) GetID added in v0.4.0

func (mr *MockProbesMockRecorder) GetID() *gomock.Call

GetID indicates an expected call of GetID.

func (*MockProbesMockRecorder) Liveness added in v0.4.0

func (mr *MockProbesMockRecorder) Liveness() *gomock.Call

Liveness indicates an expected call of Liveness.

func (*MockProbesMockRecorder) Readiness added in v0.4.0

func (mr *MockProbesMockRecorder) Readiness() *gomock.Call

Readiness indicates an expected call of Readiness.

type Probes

type Probes interface {
	Liveness() bool
	Readiness() bool
	GetID() string
}

Probes is the interface for liveness and readiness probes

type ProtocolType added in v0.4.0

type ProtocolType string

ProtocolType identifies the protocol used for a connection

const (
	// ProtocolHTTP means that the protocol used will be http://
	ProtocolHTTP ProtocolType = "http"

	// ProtocolHTTPS means that the protocol used will be https://
	ProtocolHTTPS ProtocolType = "https"
)

Jump to

Keyboard shortcuts

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