mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Use timing instead of histogram for http requests
This commit is contained in:
parent
04b5d4b79b
commit
da04eb7bc3
1 changed files with 4 additions and 4 deletions
|
|
@ -239,13 +239,13 @@ func (h *Handler) collectStats(next http.Handler) http.Handler {
|
|||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
t := time.Now()
|
||||
next.ServeHTTP(w, r)
|
||||
dif := time.Since(t)
|
||||
dur := time.Since(t)
|
||||
|
||||
statsTags := make([]string, 0, 4)
|
||||
|
||||
longQueryTime := h.api.LongQueryTime()
|
||||
if longQueryTime > 0 && dif > longQueryTime {
|
||||
h.logger.Printf("%s %s %v", r.Method, r.URL.String(), dif)
|
||||
if longQueryTime > 0 && dur > longQueryTime {
|
||||
h.logger.Printf("%s %s %v", r.Method, r.URL.String(), dur)
|
||||
statsTags = append(statsTags, "slow_query")
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ func (h *Handler) collectStats(next http.Handler) http.Handler {
|
|||
|
||||
stats := h.api.StatsWithTags(statsTags)
|
||||
if stats != nil {
|
||||
stats.Histogram("http.request", float64(dif), 0.1)
|
||||
stats.Timing("http.request", dur, 0.1)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue