detect CloseNotify capability in accesslog and metrics

This commit is contained in:
mpl 2019-12-10 18:18:04 +01:00 committed by Traefiker Bot
parent 1d4f10bead
commit bdf4c6723f
5 changed files with 59 additions and 4 deletions

View file

@ -89,10 +89,10 @@ func (m *metricsMiddleware) ServeHTTP(rw http.ResponseWriter, req *http.Request)
}(labels)
start := time.Now()
recorder := &responseRecorder{rw, http.StatusOK}
recorder := newResponseRecorder(rw)
m.next.ServeHTTP(recorder, req)
labels = append(labels, "code", strconv.Itoa(recorder.statusCode))
labels = append(labels, "code", strconv.Itoa(recorder.getCode()))
m.reqsCounter.With(labels...).Add(1)
m.reqDurationHistogram.With(labels...).Observe(time.Since(start).Seconds())
}