prometheus: fixing prom Handler to use the custom registry

Co-authored-by: Jean-Baptiste Doumenjou <925513+jbdoumenjou@users.noreply.github.com>
This commit is contained in:
Tom Moulard
2021-04-07 17:16:03 +02:00
committed by GitHub
parent e73fd70add
commit bc8d36a68e

View File

@@ -65,7 +65,9 @@ type PrometheusHandler struct{}
// AddRoutes adds Prometheus routes on a router.
func (h PrometheusHandler) AddRoutes(router *mux.Router) {
router.Methods(http.MethodGet).Path("/metrics").Handler(promhttp.Handler())
router.Methods(http.MethodGet).Path("/metrics").Handler(
promhttp.HandlerFor(promRegistry, promhttp.HandlerOpts{}),
)
}
// RegisterPrometheus registers all Prometheus metrics.