http metric redefine fail/ok
This commit is contained in:
parent
32610be3ec
commit
deaf17e178
@ -53,12 +53,10 @@ func httpMetrics(app *gin.Engine) *gin.Engine {
|
|||||||
defer timer.ObserveDuration()
|
defer timer.ObserveDuration()
|
||||||
c.Next()
|
c.Next()
|
||||||
status := c.Writer.Status()
|
status := c.Writer.Status()
|
||||||
if status >= 500 {
|
if status >= 400 {
|
||||||
processTotal.WithLabelValues("http", api, "fail").Inc()
|
processTotal.WithLabelValues("http", api, "fail").Inc()
|
||||||
} else if status == 200 {
|
|
||||||
processTotal.WithLabelValues("http", api, "ok").Inc()
|
|
||||||
} else {
|
} else {
|
||||||
panic("undefined status")
|
processTotal.WithLabelValues("http", api, "ok").Inc()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return app
|
return app
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user