Skip to content

Golang library that helps creating Healthchecks endpoints that follow the IETF RFC Health Check Response Format for HTTP APIs specification.

License

Notifications You must be signed in to change notification settings

brpaz/go-healthcheck

Repository files navigation

go-healthcheck

Golang library that helps creating Healthchecks endpoints that follow the IETF RFC Health Check Response Format for HTTP APIs specification.

Go version Go Report Card CI Status Coverage Status

License: MIT Commitizen friendly semantic-release

Features

This library helps creating Healthchecks endpoints that follows the IETF RFC Health Check Response Format for HTTP APIs specification.

It´s heavily inspired by health-go but the checks are setup in a different way. It also doesnt include any HTTP handler by default. It´s up to you to use the healthcheck library to build the formatted healthcheck response and then adapt to your handler of choice.

It includes the following Healthchecks by default:

  • Sysinfo (Uptime, Memory Usage, Load Average, etc)
  • Database
  • Url
  • TCP

Usage

package main

import (
    "github.com/brpaz/go-healthcheck"
    "github.com/brpaz/go-healthcheck/checks"
)

func main() {
    health := healthcheck.New("myservice", "Some Test service", "1.0.0", "1.0.0-SNAPSHOT")
    health.AddCheckProvider(checks.NewSysInfoChecker())

    result := health.Get()

    // TODO use the result in your HTTP handler to send the response to the health endpoint.
} 

For instructions how to use the specific checks provided in this package, please see this.

Creating new checks.

It´s very simple to create a new check. Just create a struct that implements the Check provider interface and register it in the healthcheck struct. You can see examples in the checks directory of this project.

Run tests

make tests

🤝 Contributing

Contributions, issues and feature requests are welcome!

Author

👤 Bruno Paz

📝 License

Copyright Bruno Paz.

This project is MIT licensed.

About

Golang library that helps creating Healthchecks endpoints that follow the IETF RFC Health Check Response Format for HTTP APIs specification.

Resources

License

Stars

Watchers

Forks

Packages

No packages published