Categorygithub.com/cloudogu/go-health
modulepackage
0.0.0-20180424113502-e96095b4c224
Repository: https://github.com/cloudogu/go-health.git
Documentation: pkg.go.dev

# README

go-health

Health checks for the go programming language.

Usage

First we have to create a health check:

http

checker := health.NewHTTPHealthCheckBuilder("http://localhost:8080/healthy").
    WithMethod("POST").
    WithHeader("Content-Type", "text/plain").
    WithBasicAuth("trillian", "tricia123").
    WithExpectedStatusCode(204).
    Build()

tcp

checker := health.NewTCPHealthCheckBuilder(6379).
  WithHostname("redis.hitchhiker.com").
  WithTimeout(1 * time.Second).
  Build()

Than we can wait until the check becomes healthy:

watcher := health.NewWatcher()
err := watcher.WaitUntilHealthy(checker)
if err != nil {
  // check does not become healthy and the timeout is reached
}

# Functions

NewHTTPHealthCheckBuilder creates new options for the http health check with useful defaults.
NewHTTPHealthChecker creates a new http health check with useful defaults.
NewHTTPHealthCheckerWithOptions creates a new http health check with the given options.
NewTCPHealthCheckBuilder creates a builder for tcp health checks.
NewTCPHealthChecker creates a new tcp health check for the given host and port.
NewTCPHealthCheckerWithOptions creates a new tcp health check for the given options.
NewWatcher creates a new watcher with useful defaults.

# Structs

HTTPHealthCheckBuilder.
HTTPHealthCheckOptions defines options for the http health check.
TCPHealthCheckBuilder build for tcp health checks.
TCPHealthCheckOptions defines options for the tcp health check.
Watcher is able to block until a checker becomes healthy.

# Type aliases

CheckResultListener is always called with the latest result from the executor.
No description provided by the author