Remove urls from stat names, instead tag http.request stats with url

This commit is contained in:
Cody Soyland 2019-06-05 17:12:32 -05:00 committed by Matt Jaffee
parent 2de8060f2c
commit 97e1822445
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF

View file

@ -300,7 +300,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
dif := time.Since(t)
// Calculate per request StatsD metrics when the handler is fully configured.
statsTags := make([]string, 0, 3)
statsTags := make([]string, 0, 4)
longQueryTime := h.api.LongQueryTime()
if longQueryTime > 0 && dif > longQueryTime {
@ -308,8 +308,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
statsTags = append(statsTags, "slow_query")
}
pathParts := strings.Split(r.URL.Path, "/")
endpointName := strings.Join(pathParts, "_")
statsTags = append(statsTags, "url:"+r.URL.Path)
if externalPrefixFlag[pathParts[1]] {
statsTags = append(statsTags, "external")
@ -319,7 +318,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
statsTags = append(statsTags, "useragent:"+r.UserAgent())
stats := h.api.StatsWithTags(statsTags)
if stats != nil {
stats.Histogram("http."+endpointName, float64(dif), 0.1)
stats.Histogram("http.request", float64(dif), 0.1)
}
}