Browse Source

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

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
pull/12472/head
Matthias Loibl 1 year ago
parent
commit
8bc2a19469
No known key found for this signature in database
GPG Key ID: 78A796CA74CA38BA
  1. 1
      web/web.go

1
web/web.go

@ -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(

Loading…
Cancel
Save