Add a metric "http_requests_in_flight"

This commit is contained in:
Ivan Ivanov 2020-06-02 20:08:03 +03:00 committed by Will Norris
parent bbd716c747
commit 606b3fbbf5
2 changed files with 12 additions and 1 deletions

View file

@ -223,7 +223,12 @@ func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
timer := prometheus.NewTimer(metricRequestDuration)
defer timer.ObserveDuration()
metricRequestsInFlight.Inc()
defer func() {
timer.ObserveDuration()
metricRequestsInFlight.Dec()
}()
h.ServeHTTP(w, r)
}