mirror of
https://github.com/sot-tech/mochi.git
synced 2026-05-11 06:39:08 -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()
|
start := time.Now()
|
||||||
|
|
||||||
httpCode, err := handler(w, r, p)
|
httpCode, err := handler(w, r, p)
|
||||||
|
stats.RecordEvent(stats.HandledRequest)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
stats.RecordEvent(stats.ErroredRequest)
|
||||||
http.Error(w, err.Error(), httpCode)
|
http.Error(w, err.Error(), httpCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user