health

package
v0.0.0-...-ca3ac9b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DoSHealth = "health"

Variables

This section is empty.

Functions

func NewHealthHandler

func NewHealthHandler() api.Handler

Types

type Check

type Check interface {
	// CheckName shoulld return the name of this healthcheck. The name should be unique.
	CheckName() string
	// Check proceed a check and return state, true for healthy or false and an optional error, if the healthcheck fails
	Check() (bool, error)
}

type Config

type Config struct {
	// Period in seconds, when all health services should run
	Period int `yaml:"period"`
	// StartDelay an optional starting delay, after starting the service
	StartDelay int `yaml:"startdelay"`
}

Config configuration for the healthcheck system

type Handler

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

Handler is the default handler factory for HTTP requests against the healthsystem

func (*Handler) GetLivenessEndpoint

func (h *Handler) GetLivenessEndpoint(response http.ResponseWriter, req *http.Request)

GetLivenessEndpoint liveness probe

func (*Handler) GetReadinessEndpoint

func (h *Handler) GetReadinessEndpoint(response http.ResponseWriter, req *http.Request)

GetReadinessEndpoint is this service ready for taking requests, e.g. formerly known as health checksfunc GetReadinessEndpoint(response http.ResponseWriter, req *http.Request) {

func (*Handler) HeadLivenessEndpoint

func (h *Handler) HeadLivenessEndpoint(response http.ResponseWriter, req *http.Request)

HeadLivenessEndpoint liveness probe

func (*Handler) HeadReadinessEndpoint

func (h *Handler) HeadReadinessEndpoint(response http.ResponseWriter, req *http.Request)

HeadReadinessEndpoint is this service ready for taking requests, e.g. formaly known as health checks

func (*Handler) Routes

func (h *Handler) Routes() (string, *chi.Mux)

Routes getting all routes for the health endpoint

type Message

type Message struct {
	Messages  []string `json:"messages"`
	LastCheck string   `json:"lastCheck,omitempty"`
}

Msg a health message

type SHealth

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

SHealthCheck this is the healthcheck service

func NewHealthSystem

func NewHealthSystem(config Config) (*SHealth, error)

NewHealthSystem initialize the complete health system

func (*SHealth) Init

func (h *SHealth) Init() error

func (*SHealth) Message

func (h *SHealth) Message() Message

func (*SHealth) Register

func (h *SHealth) Register(check Check)

Jump to

Keyboard shortcuts

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