tech(metrics): move all request counters into one middleware

This commit is contained in:
bergquist
2016-09-09 13:28:19 +02:00
parent 583790e650
commit e7b56c6389
5 changed files with 41 additions and 14 deletions

View File

@ -208,15 +208,6 @@ func (ctx *Context) Handle(status int, title string, err error) {
}
}
switch status {
case 200:
metrics.M_Page_Status_200.Inc(1)
case 404:
metrics.M_Page_Status_404.Inc(1)
case 500:
metrics.M_Page_Status_500.Inc(1)
}
ctx.Data["Title"] = title
ctx.HTML(status, strconv.Itoa(status))
}
@ -243,10 +234,8 @@ func (ctx *Context) JsonApiErr(status int, message string, err error) {
switch status {
case 404:
metrics.M_Api_Status_404.Inc(1)
resp["message"] = "Not Found"
case 500:
metrics.M_Api_Status_500.Inc(1)
resp["message"] = "Internal Server Error"
}