health

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: ISC Imports: 5 Imported by: 0

Documentation

Overview

Package health is used for implementing health checks for services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlerFunc

func HandlerFunc() http.HandlerFunc

HandlerFunc returns an http handler function for checking the health of registered checkers.

func RegisterChecker

func RegisterChecker(c ...Checker)

RegisterChecker registers new health checkers.

func SetLogger

func SetLogger(l Logger)

SetLogger enables logging.

func SetTimeout

func SetTimeout(d time.Duration)

SetTimeout sets the timeout for health checkers. If the timeout reaches, the health check is considered failed. The default timeout is 5 seconds.

Types

type Checker

type Checker interface {
	fmt.Stringer
	CheckHealth(context.Context) error
}

Checker is the interface for checking the health of a component.

type Logger

type Logger interface {
	Errorf(string, ...interface{})
}

Logger is a simple interface for logging.

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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