mirror of
https://github.com/LBRYFoundation/tracker.git
synced 2025-08-23 17:47:29 +00:00
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()
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue