healthz

package
v1.2.115 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallHandler

func InstallHandler(mux Muxer, checks ...HealthChecker)

InstallHandler registers handlers for health checking on the path "/healthz" to Muxer. *All handlers* for Muxer must be specified in exactly one call to InstallHandler. Calling InstallHandler more than once for the same Muxer will result in a panic.

func InstallLivezHandler

func InstallLivezHandler(mux Muxer, checks ...HealthChecker)

InstallLivezHandler registers handlers for liveness checking on the path "/livez" to Muxer. *All handlers* for Muxer must be specified in exactly one call to InstallHandler. Calling InstallHandler more than once for the same Muxer will result in a panic.

func InstallPathHandler

func InstallPathHandler(mux Muxer, path string, checks ...HealthChecker)

InstallPathHandler registers handlers for health checking on a specific path to Muxer. *All handlers* for the path must be specified in exactly one call to InstallPathHandler. Calling InstallPathHandler more than once for the same path and Muxer will result in a panic.

func InstallPathHandlerWithHealthyFunc

func InstallPathHandlerWithHealthyFunc(mux Muxer, path string, firstTimeHealthy func(), checks ...HealthChecker)

InstallPathHandlerWithHealthyFunc is like InstallPathHandler, but calls firstTimeHealthy exactly once when the handler succeeds for the first time.

func InstallReadyzHandler

func InstallReadyzHandler(mux Muxer, checks ...HealthChecker)

InstallReadyzHandler registers handlers for health checking on the path "/readyz" to Muxer. *All handlers* for Muxer must be specified in exactly one call to InstallHandler. Calling InstallHandler more than once for the same Muxer will result in a panic.

func InstallReadyzHandlerWithHealthyFunc

func InstallReadyzHandlerWithHealthyFunc(mux Muxer, firstTimeReady func(), checks ...HealthChecker)

InstallReadyzHandlerWithHealthyFunc is like InstallReadyzHandler, but in addition call firstTimeReady the first time /readyz succeeds.

Types

type HealthChecker

type HealthChecker interface {
	Name() string
	Check(req *http.Request) error
}

HealthChecker is a named healthz checker.

var LogHealthCheck HealthChecker = &log{}

LogHealthCheck returns true if logging is not blocked

var PingHealthzCheck HealthChecker = ping{}

PingHealthzCheck returns true automatically when checked

func NamedCheck

func NamedCheck(name string, check func(r *http.Request) error) HealthChecker

NamedCheck returns a healthz checker for the given name and function.

func NamedDeadlineCheck

func NamedDeadlineCheck(name string, d time.Time, check func(r *http.Request, d time.Time) error) HealthChecker

NamedDeadlineCheck returns a healthz checker for the given name, deadline and function.

func NamedTimeoutCheck

func NamedTimeoutCheck(name string, timeout time.Duration, check func(r *http.Request, timeout time.Duration) error) HealthChecker

NamedTimeoutCheck returns a healthz checker for the given name , timeout and function.

func NewInformerSyncHealthz

func NewInformerSyncHealthz(cacheSyncWaiter cacheSyncWaiter) HealthChecker

NewInformerSyncHealthz returns a new HealthChecker that will pass only if all informers in the given cacheSyncWaiter sync.

type Muxer

type Muxer interface {
	Handle(pattern string, handler http.Handler)
}

Muxer is an interface describing the methods InstallHandler requires.

Jump to

Keyboard shortcuts

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