metrics: add /health endpoint for healthchecks

Because calling `/metrics` for a Consul healhcheck is too heavy
and far too verbose.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-10-15 12:38:52 +02:00
parent c86db00285
commit 42cf5430c9
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020

View File

@ -40,6 +40,11 @@ func NewMetricsServer(address string, port int) *Server {
mux := http.NewServeMux()
mux.Handle("/metrics", pe)
// Healthcheck
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "OK")
})
h := &ochttp.Handler{Handler: mux}
// Register the views