Add request method to stats

This commit is contained in:
Cody Soyland 2019-06-07 09:20:40 -05:00
parent da04eb7bc3
commit 363a19b321

View file

@ -241,7 +241,7 @@ func (h *Handler) collectStats(next http.Handler) http.Handler {
next.ServeHTTP(w, r)
dur := time.Since(t)
statsTags := make([]string, 0, 4)
statsTags := make([]string, 0, 5)
longQueryTime := h.api.LongQueryTime()
if longQueryTime > 0 && dur > longQueryTime {
@ -261,6 +261,8 @@ func (h *Handler) collectStats(next http.Handler) http.Handler {
statsTags = append(statsTags, "path:"+path)
}
statsTags = append(statsTags, "method:"+r.Method)
stats := h.api.StatsWithTags(statsTags)
if stats != nil {
stats.Timing("http.request", dur, 0.1)