healthcheck

package
v1.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HealthCheck added in v1.1.0

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

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

func New added in v1.1.0

func New(state Status, options ...Option) *HealthCheck

New creates a HealthCheck with the specified initial state.

func (*HealthCheck) Close added in v1.1.0

func (hc *HealthCheck) Close() error

Close stops the HTTP server

func (*HealthCheck) Get added in v1.1.0

func (hc *HealthCheck) Get() Status

Get the current status of this health check

func (*HealthCheck) Ready added in v1.1.0

func (hc *HealthCheck) Ready()

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

func (*HealthCheck) Serve added in v1.1.0

func (hc *HealthCheck) Serve(port int) (*HealthCheck, error)

Serve starts HTTP server on the specified port.

func (*HealthCheck) Set added in v1.1.0

func (hc *HealthCheck) Set(state Status)

Set a new health check status

type Option added in v1.1.0

type Option func(*HealthCheck)

Option is a functional option for passing parameters to New()

func Logger added in v1.1.0

func Logger(logger *zap.Logger) Option

Logger creates an option to set the logger. If not specified, Nop logger is used.

type Status added in v1.1.0

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 added in v1.1.0

func (s Status) String() string

Jump to

Keyboard shortcuts

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