healthcheck

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthCheck

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

HealthCheck provides an HTTP endpoint that returns the health status of the service

func New

func New() *HealthCheck

New creates a HealthCheck with the specified initial state.

func (*HealthCheck) Get

func (hc *HealthCheck) Get() Status

Get the current status of this health check

func (*HealthCheck) Handler

func (hc *HealthCheck) Handler() http.Handler

Handler creates a new HTTP handler.

func (*HealthCheck) Ready

func (hc *HealthCheck) Ready()

Ready is a shortcut for Set(Ready) (kept for backwards compatibility)

func (*HealthCheck) Set

func (hc *HealthCheck) Set(status Status)

Set a new health check status

func (*HealthCheck) SetLogger

func (hc *HealthCheck) SetLogger(logger *zap.Logger)

SetLogger initializes a logger.

type Status

type Status int

Status represents the state of the service.

const (
	// Unavailable indicates the service is not able to handle requests
	Unavailable Status = iota
	// Ready indicates the service is ready to handle requests
	Ready
	// Broken indicates that the healthcheck itself is broken, not serving HTTP
	Broken
)

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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