1
0
Fork 0

Improving instrumentation. (#1042)

This commit is contained in:
Alberto 2017-01-17 18:14:13 +01:00 committed by Vincent Demeester
parent 483ef486af
commit fa1090b6eb
5 changed files with 19 additions and 10 deletions

View file

@ -37,7 +37,7 @@ func (m *MetricsWrapper) ServeHTTP(rw http.ResponseWriter, r *http.Request, next
next(prw, r)
labels := []string{"code", strconv.Itoa(prw.StatusCode()), "method", r.Method}
m.Impl.getReqsCounter().With(labels...).Add(1)
m.Impl.getLatencyHistogram().With(labels...).Observe(float64(time.Since(start).Nanoseconds()) / 1000000)
m.Impl.getLatencyHistogram().Observe(float64(time.Since(start).Seconds()))
}
func (rw *responseRecorder) StatusCode() int {