Programming language: Go
License: MIT License
Tags: Miscellaneous    
Latest version: v2.0.3

healthcheck alternatives and similar packages

Based on the "Miscellaneous" category.
Alternatively, view healthcheck alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of healthcheck or a related project?

Add another 'Miscellaneous' Package



Build Status Go Report Card GoDoc codecov FOSSA Status

A simple and extensible RESTful Healthcheck API implementation for Go services.

Health provides an http.Handlefunc for use as a healthcheck endpoint used by external services or load balancers. The function is used to determine the health of the application and to remove unhealthy application hosts or containers from rotation.

Instead of blindly returning a 200 HTTP status code, a healthcheck endpoint should test all the mandatory dependencies that are essential for proper functioning of a web service.

Implementing the Checker interface and passing it on to healthcheck allows you to test the the dependencies such as a database connection, caches, files and even external services you rely on. You may choose to not fail the healthcheck on failure of certain dependencies such as external services that you are not always dependent on.


package main

import (

    _ "github.com/go-sql-driver/mysql"

func main() {
    // For brevity, error check is being omitted here.
    db, _ := sql.Open("mysql", "user:password@/dbname")
    defer db.Close()

    r := mux.NewRouter()
    r.Handle("/healthcheck", healthcheck.Handler(

        // WithTimeout allows you to set a max overall timeout.

        // Checkers fail the status in case of any error.
            "heartbeat", checkers.Heartbeat("$PROJECT_PATH/heartbeat"),

            "database", healthcheck.CheckerFunc(
                func(ctx context.Context) error {
                    return db.PingContext(ctx)

        // Observers do not fail the status in case of error.
            "diskspace", checkers.DiskSpace("/var/log", 90),

    http.ListenAndServe(":8080", r)

Based on the example provided above, curl localhost:8080/healthcheck | jq should yield on error a response with an HTTP statusCode of 503.

  "status": "Service Unavailable",
  "errors": {
    "database": "dial tcp getsockopt: connection refused",
    "heartbeat": "heartbeat not found. application should be out of rotation"


This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file.

FOSSA Status

*Note that all licence references and agreements mentioned in the healthcheck README section above are relevant to that project's source code only.