Monitor Your Golang Microservices using the Health Checks API
What is it?
The Go Health Checks Framework is a declarative, extendable health checking framework written in Go that provides a simple way to register dependencies as status endpoints and integrate them into an existing microservice that uses either the standard net/http package or the Gin Framework.
Monitor From the Inside
The Health Checks API helps you monitor your service health from the inside by exposing a set of standardized endpoints at “/status/…” that can be monitored using any monitoring framework.
We have found that the best way to monitor the health of a microservice is from the inside. This is because it is the single source of real truth for its health. If you’re not monitoring from the inside, then you are inferring the health of the microservice and this comes with its own problems. Not convinced? Watch this talk by Kelsey Hightower titled Stop reverse engineering applications and start monitoring from the inside.
Using the Go Health Checks Framework in your Golang microservice is easy:
- Define a StatusEndpoint for each dependency in your microservice.
- Configure framework options and register the Health Checks framework to respond to all /status/… requests passing a slice of all your StatusEndpoints.
That’s it! As long as you have defined your StatusEndpoints correctly, the framework will take care of the rest.
Not Just Monitoring
The Health Checks API enables more than just microservice monitoring and gives you the power to explore, debug, and document your ever changing architecture. Below is a demo video of a tool we use that displays a dashboard for each microservice in a distributed application and lets developers/ops navigate the microservice graph in real time. This dashboard not only shows information about the services in your graph, but also displays the current status of each microservice in the graph and its dependencies. The open sourcing of this tool is coming soon!
Want to learn more?
- Health Checks API – A cross language standard for checking health in a distributed application
- Go Health Checks Framework – A Golang implementation of the Health Checks API used for microservice exploration, documentation and monitoring.