https://github.com/cloudogu/go-health
Health checks for the go programming language
https://github.com/cloudogu/go-health
go golang health healthcheck
Last synced: 10 months ago
JSON representation
Health checks for the go programming language
- Host: GitHub
- URL: https://github.com/cloudogu/go-health
- Owner: cloudogu
- Created: 2018-04-17T14:15:06.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-24T11:35:12.000Z (about 8 years ago)
- Last Synced: 2025-08-14T19:59:39.033Z (11 months ago)
- Topics: go, golang, health, healthcheck
- Language: Go
- Size: 6.84 KB
- Stars: 1
- Watchers: 13
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-health
Health checks for the go programming language.
## Usage
First we have to create a health check:
### http
```go
checker := health.NewHTTPHealthCheckBuilder("http://localhost:8080/healthy").
WithMethod("POST").
WithHeader("Content-Type", "text/plain").
WithBasicAuth("trillian", "tricia123").
WithExpectedStatusCode(204).
Build()
```
### tcp
```go
checker := health.NewTCPHealthCheckBuilder(6379).
WithHostname("redis.hitchhiker.com").
WithTimeout(1 * time.Second).
Build()
```
Than we can wait until the check becomes healthy:
```go
watcher := health.NewWatcher()
err := watcher.WaitUntilHealthy(checker)
if err != nil {
// check does not become healthy and the timeout is reached
}
```