health

package
v0.0.0-...-b7d4bf0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Ctl is a global health controller
	Ctl = NewController()
)

Functions

func HTTPStatusCodeHealthChecker

func HTTPStatusCodeHealthChecker(method string, url string, header http.Header,
	timeout time.Duration, statusCode int) health.Checker

HTTPStatusCodeHealthChecker implements a Checker to check that the HTTP status code returned matches the expected one

func PeriodicHealthChecker

func PeriodicHealthChecker(checker health.Checker, period time.Duration) health.Checker

PeriodicHealthChecker implements a Checker to check status periodically

func RegisterHealthCheckers

func RegisterHealthCheckers()

RegisterHealthCheckers ...

Types

type ComponentHealthStatus

type ComponentHealthStatus struct {
	Name   string `json:"name"`
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
}

ComponentHealthStatus defines the specific component health status

type Controller

type Controller interface {
	GetHealth(ctx context.Context) *OverallHealthStatus
}

Controller defines the health related operations

func NewController

func NewController() Controller

NewController returns a health controller instance

type OverallHealthStatus

type OverallHealthStatus struct {
	Status     string                   `json:"status"`
	Components []*ComponentHealthStatus `json:"components"`
}

OverallHealthStatus defines the overall health status of the system

Jump to

Keyboard shortcuts

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