health

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package health contains code for health checks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetVersion

func GetVersion() string

GetVersion returns service's version and commit.

func Handler

func Handler(timeout time.Duration, p ...Pinger) func(w http.ResponseWriter, r *http.Request)

Types

type Pinger

type Pinger interface {
	// Ping returns object with meta information and error
	Ping(ctx context.Context) (interface{}, error)
	// Name returns name of pinger
	Name() string
}

Pinger pings external service.

func SubjectPinger

func SubjectPinger(s string, f func(ctx context.Context) error) Pinger

SubjectPinger returns wrapper over Ping function which adds subject to error message. It is helpful for external Ping function, e.g. (sql.DB).Ping.

type VersionResponse

type VersionResponse struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
}

VersionResponse ...

Jump to

Keyboard shortcuts

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