web: Initialize requestCounter metrics to 0 with handler and 200k labels.

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
This commit is contained in:
Matthias Loibl 2023-06-19 17:40:15 +02:00
parent 86a7064dcf
commit 8bc2a19469
No known key found for this signature in database
GPG key ID: 78A796CA74CA38BA

View file

@ -158,6 +158,7 @@ func (m *metrics) instrumentHandlerWithPrefix(prefix string) func(handlerName st
}
func (m *metrics) instrumentHandler(handlerName string, handler http.HandlerFunc) http.HandlerFunc {
m.requestCounter.WithLabelValues(handlerName, "200").Add(0)
return promhttp.InstrumentHandlerCounter(
m.requestCounter.MustCurryWith(prometheus.Labels{"handler": handlerName}),
promhttp.InstrumentHandlerDuration(