Improving instrumentation. (#1042)
This commit is contained in:
parent
483ef486af
commit
fa1090b6eb
5 changed files with 19 additions and 10 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue