healthz

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: MIT Imports: 1 Imported by: 0

README

healthz

healthz is a simple package to add liveness and readiness probes to your application, primarily for kubernetes support

Probes are defined as type CheckFunc func() bool. If this function returns true, the probe passes.

healthz will expose two HTTP endpoints:

  • /healthz/alive
  • /healthz/ready

By default, both use a simple check that always returns true. For passsing probes, the endpoints return 200 OK. For failing probes the endpoints return 503 Service Unavailable.

Eample usage

See example/example.go for example usage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMux

func CreateMux() *http.ServeMux

CreateMux creates an *http.ServeMux with handlers for /healthz/alive and /healthz/ready. The endpoints will return 200 OK if their respective CheckFunc returns true and 503 Service Unavailable if it returns false. If no CheckFunc was specified for the corresponding endpoint, the default probe is used and always returns true

func LivenessCheck

func LivenessCheck(fn CheckFunc)

LivenessCheck sets the probe for the /healthz/alive endpoint

func ReadinessCheck

func ReadinessCheck(fn CheckFunc)

ReadinessCheck sets the prod for the /healthz/ready endpoint

Types

type CheckFunc

type CheckFunc func() bool

CheckFunc is a function that returns true if the probe is passing

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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