healthcheck

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(s *State) (http.Handler, error)

NewHandler creates a new HTTP handler using the given state as source of information

func ServeWithListener

func ServeWithListener(l net.Listener, s *http.Server, logger *zap.Logger) (*http.Server, error)

ServeWithListener starts a new HTTP server on the given port and with the provided handler

Types

type State

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

State represents the current health check state

func NewState

func NewState(state int, logger *zap.Logger) (*State, error)

NewState creates a new state instance. The initial state is what's specified with the state parameter

func Serve

func Serve(state int, port int, logger *zap.Logger) (*State, error)

Serve requests on the specified port. The initial state is what's specified with the state parameter

func (*State) Get

func (s *State) Get() int

Get the current status code for this health check

func (*State) Ready

func (s *State) Ready()

Ready updates the current state to the "ready" state, translated as a 2xx-class HTTP status code

func (*State) Set

func (s *State) Set(state int)

Set a new HTTP status for the health check

Jump to

Keyboard shortcuts

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