health

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package health provides functions for reporting the health status of individual components in the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHealthCheck

func AddHealthCheck(name string, check func() error)

AddHealthCheck adds a new named component to the health check results.

func AddReadyCheck

func AddReadyCheck(fn ReadyFunc)

AddReadyCheck adds a new ReadyFunc to the readiness check. The readiness endpoint returns an error if one of the functions returns false.

func CheckKubernetesAPI

func CheckKubernetesAPI(cnf *rest.Config) func() error

CheckKubernetesAPI returns a function that returns a non-nil error when the connection to the Kubernetes cluster is deemed unhealthy.

func Serve

func Serve(r *http.ServeMux)

Serve health/ready checks via HTTP on the provided router.

Types

type Check

type Check struct {
	Name    string `json:"name"`
	Healthy bool   `json:"healthy"`
	Message string `json:"message,omitempty"`
}

The Check type describes the health of an individual component.

type Health

type Health struct {
	Application string    `json:"application,omitempty"`
	Version     string    `json:"version,omitempty"`
	Compiled    time.Time `json:"compiled,omitempty"`
	Description string    `json:"description,omitempty"`
	Healthy     bool      `json:"healthy"`
	Checks      []Check   `json:"checks,omitempty"`
}

The Health type contains fields that describe the health of an application and its components.

type ReadyFunc

type ReadyFunc func() bool

The ReadyFunc type is used to indicate if a component of the application is ready or not.

Jump to

Keyboard shortcuts

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