healthcheck: Index | Files | Directories

package healthcheck

import ""


Package Files


func Handler Uses

func Handler(opts ...Option) http.Handler

Handler returns an http.Handler

func HandlerFunc Uses

func HandlerFunc(opts ...Option) http.HandlerFunc

HandlerFunc returns an http.HandlerFunc to mount the API implementation at a specific route

type Checker Uses

type Checker interface {
    Check(ctx context.Context) error

Checker checks the status of the dependency and returns error. In case the dependency is working as expected, return nil.

type CheckerFunc Uses

type CheckerFunc func(ctx context.Context) error

CheckerFunc is a convenience type to create functions that implement the Checker interface.

func (CheckerFunc) Check Uses

func (c CheckerFunc) Check(ctx context.Context) error

Check Implements the Checker interface to allow for any func() error method to be passed as a Checker

type Option Uses

type Option func(*health)

Option adds optional parameter for the HealthcheckHandlerFunc

func WithChecker Uses

func WithChecker(name string, s Checker) Option

WithChecker adds a status checker that needs to be added as part of healthcheck. i.e database, cache or any external dependency

func WithObserver Uses

func WithObserver(name string, s Checker) Option

WithObserver adds a status checker but it does not fail the entire status.

func WithTimeout Uses

func WithTimeout(timeout time.Duration) Option

WithTimeout configures the global timeout for all individual checkers.



Package healthcheck imports 6 packages (graph) and is imported by 4 packages. Updated 2019-12-27. Refresh now. Tools for package owners.