add type to prometheus metrics (#2916)

This commit is contained in:
Jess G 2019-08-29 14:42:38 -07:00 committed by Stefan Benten
parent 9d1910cb2b
commit b20dcfd64c

View File

@ -84,6 +84,7 @@ func prometheus(w http.ResponseWriter, r *http.Request) {
// (https://prometheus.io/docs/concepts/metric_types/)
monkit.Default.Stats(func(name string, val float64) {
metric := sanitize(name)
_, _ = fmt.Fprintf(w, "%s %g\n", metric, val)
_, _ = fmt.Fprintf(w, "# TYPE %s gauge\n%s %g\n",
metric, metric, val)
})
}