health

package
v1.4.9 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 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

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

SimpleHandler returns a simple http handler for health checks.

Types

type HTTPProbe

type HTTPProbe struct {
	URL      string
	Protocol ProtocolType
}

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

func (HTTPProbe) Probe

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

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

MockProbes is a mock of Probes interface.

func NewMockProbes

func NewMockProbes(ctrl *gomock.Controller) *MockProbes

NewMockProbes creates a new mock instance.

func (*MockProbes) EXPECT

func (m *MockProbes) EXPECT() *MockProbesMockRecorder

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

func (*MockProbes) GetID

func (m *MockProbes) GetID() string

GetID mocks base method.

func (*MockProbes) Liveness

func (m *MockProbes) Liveness() bool

Liveness mocks base method.

func (*MockProbes) Readiness

func (m *MockProbes) Readiness() bool

Readiness mocks base method.

type MockProbesMockRecorder

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

MockProbesMockRecorder is the mock recorder for MockProbes.

func (*MockProbesMockRecorder) GetID

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

GetID indicates an expected call of GetID.

func (*MockProbesMockRecorder) Liveness

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

Liveness indicates an expected call of Liveness.

func (*MockProbesMockRecorder) Readiness

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

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