Instrumenting Any Application for Custom metric using Prometheus.
Today we will be learning how to add monitoring support to our Go application. Before starting we will learn more about Prometheus. What is Prometheus? Prometheus is an open-source system monitoring and alerting tool. Prometheus collects and stores its metrics as time-series data, i.e. metrics information is stored with the timestamp at which it was recorded, alongside optional key-value pairs called labels. Now we have some idea about what Prometheus is !! Let’s start the implementation. Installing Prometheus libraries. Run the below commands to install Prometheus libraries. go get github.com/prometheus/client_golang/prometheus go get github.com/prometheus/client_golang/prometheus/promauto go get github.com/prometheus/client_golang/prometheus/promhttp 2. Writing the Go application. We will implement Prometheus libraries in our Go code. To expose Prometheus metrics, We need to provide a /metrics HTTP endpoint. We will use promhttp as the handler func...