Add support for prometheus

This commit is contained in:
9seconds
2018-10-17 12:06:46 +03:00
parent 5f00363da5
commit 9346c11f37
7 changed files with 126 additions and 2 deletions
+2
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
"net/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
"go.uber.org/zap"
"github.com/9seconds/mtg/config"
@@ -32,6 +33,7 @@ func startServer(conf *config.Config) {
log.Errorw("Cannot encode json", "error", err)
}
})
http.Handle("/prometheus/", promhttp.Handler())
if err := http.ListenAndServe(conf.StatAddr(), nil); err != nil {
log.Fatalw("Stats server has been stopped", "error", err)