healthcheck

package
v0.0.0-...-132f1c2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2018 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

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(state Status, options ...Option) *HealthCheck

New creates a HealthCheck with the specified initial state.

func (*HealthCheck) Close

func (hc *HealthCheck) Close() error

Close stops the HTTP server

func (*HealthCheck) Get

func (hc *HealthCheck) Get() Status

Get the current status of this health check

func (*HealthCheck) Ready

func (hc *HealthCheck) Ready()

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

func (*HealthCheck) Serve

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

Serve starts HTTP server on the specified port.

func (*HealthCheck) Set

func (hc *HealthCheck) Set(state Status)

Set a new health check status

type Option

type Option func(*HealthCheck)

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

func Logger

func Logger(logger *zap.Logger) Option

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

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