health

package
v0.0.0-...-bb01aa7 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckerFunc

type CheckerFunc func(ctx context.Context) error

CheckerFunc wraps the CheckHealth method.

CheckHealth returns nil if the resource is healthy, or a non-nil error if the resource is not healthy. CheckHealth must be safe to call from multiple goroutines.

type Handler

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

Handler is an HTTP handler that reports on the success of an aggregate of Checkers. The zero value is always healthy.

func NewHandler

func NewHandler() *Handler

NewHandler new a health handler.

func (*Handler) AddChecker

func (h *Handler) AddChecker(name string, c CheckerFunc)

AddChecker adds a new check to the handler.

func (*Handler) AddObserver

func (h *Handler) AddObserver(name string, c CheckerFunc)

AddObserver adds a new check to the handler but it does not fail the entire status.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP returns 200 if it is healthy, 500 otherwise.

Jump to

Keyboard shortcuts

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