mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 02:32:19 +08:00
tech(metrics): move all request counters into one middleware
This commit is contained in:
@ -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"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user