healthcheck alternatives and similar packages
Based on the "Miscellaneous" category.
Alternatively, view healthcheck alternatives based on common mentions on social networks and blogs.
-
golang-standards/project-layout
Standard Go Project Layout -
go-formatter
A curated list of awesome Go frameworks, libraries and software -
archiver
Easily create & extract archives, and compress & decompress files of various formats -
ardanlabs/service
Starter code for writing web services in Go using Kubernetes. -
go-multierror
A Go (golang) package for representing a list of errors as a single error. -
go-restful-api
An idiomatic Go REST API starter kit (boilerplate) following the SOLID principles and Clean Architecture -
ghorg
Quickly clone an entire org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more 🥚 -
xstrings
Implements string functions widely used in other languages but absent in Go. -
go-chat-bot
IRC, Slack, Telegram and RocketChat bot written in go -
go-shortid
Super short, fully unique, non-sequential and URL friendly Ids -
health
An easy to use, extensible health check library for Go applications. -
gountries
Gountries provides: Countries (ISO-3166-1), Country Subdivisions(ISO-3166-2), Currencies (ISO 4217), Geo Coordinates(ISO-6709) as well as translations, country borders and other stuff exposed as struct data. -
container
A lightweight yet powerful IoC dependency injection container for the Go programming language -
golang-templates/seed
Go application GitHub repository template. -
banner
An easy way to add useful startup banners into your Go applications -
go-starter
An opinionated production-ready SQL-/Swagger-first RESTful JSON API written in Go, highly integrated with VSCode DevContainers by allaboutapps. -
countries
Countries - ISO-639, ISO-3166 countries codes with subdivisions and names, ISO-4217 currency designators, ITU-T E.164 IDD phone codes, countries capitals, UN M.49 codes, IANA ccTLD countries domains, IOC/NOC and FIFA codes, VERY VERY FAST, compatible with Databases/JSON/BSON/GOB/XML/CSV, Emoji countries flags and currencies support, Unicode CLDR. -
antch
Antch, a fast, powerful and extensible web crawling & scraping framework for Go
Access the most powerful time series database as a service
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of healthcheck or a related project?
README
Healthcheck
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.
Example
package main
import (
"context"
"database/sql"
"net/http"
"time"
"github.com/etherlabsio/healthcheck/v2"
"github.com/etherlabsio/healthcheck/v2/checkers"
_ "github.com/go-sql-driver/mysql"
"github.com/gorilla/mux"
)
func main() {
// For brevity, error check is being omitted here.
db, _ := sql.Open("mysql", "user:[email protected]/dbname")
defer db.Close()
r := mux.NewRouter()
r.Handle("/healthcheck", healthcheck.Handler(
// WithTimeout allows you to set a max overall timeout.
healthcheck.WithTimeout(5*time.Second),
// Checkers fail the status in case of any error.
healthcheck.WithChecker(
"heartbeat", checkers.Heartbeat("$PROJECT_PATH/heartbeat"),
),
healthcheck.WithChecker(
"database", healthcheck.CheckerFunc(
func(ctx context.Context) error {
return db.PingContext(ctx)
},
),
),
// Observers do not fail the status in case of error.
healthcheck.WithObserver(
"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 127.0.0.1:3306: getsockopt: connection refused",
"heartbeat": "heartbeat not found. application should be out of rotation"
}
}
License
This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file.
*Note that all licence references and agreements mentioned in the healthcheck README section above
are relevant to that project's source code only.