mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-09 21:59:09 -07:00
Implement RequestsHandled and RequestsErrored stats
This commit is contained in:
@@ -31,7 +31,10 @@ func makeHandler(handler ResponseHandler) httprouter.Handle {
|
||||
start := time.Now()
|
||||
|
||||
httpCode, err := handler(w, r, p)
|
||||
stats.RecordEvent(stats.HandledRequest)
|
||||
|
||||
if err != nil {
|
||||
stats.RecordEvent(stats.ErroredRequest)
|
||||
http.Error(w, err.Error(), httpCode)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user