Implement RequestsHandled and RequestsErrored stats
This commit is contained in:
parent
6fdb68d9b2
commit
38d2c91ff1
1 changed files with 3 additions and 0 deletions
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue