Add response time stats

This commit is contained in:
Justin Li
2014-07-22 14:57:36 -04:00
parent 0a4c290ecb
commit 7fce8c9ad4
3 changed files with 47 additions and 3 deletions

View File

@@ -38,13 +38,16 @@ func makeHandler(handler ResponseHandler) httprouter.Handle {
http.Error(w, err.Error(), httpCode)
}
duration := time.Since(start)
stats.RecordTiming(stats.ResponseTime, duration)
if glog.V(2) {
glog.Infof(
"Completed %v %s %s in %v",
httpCode,
http.StatusText(httpCode),
r.URL.Path,
time.Since(start),
duration,
)
}
}