fix: middleware now record real success info
This commit is contained in:
parent
529b41332c
commit
2ae99e2636
@ -21,5 +21,6 @@ func Wrap(status Status, body interface{}) interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Pong(c *gin.Context, status Status, body interface{}) {
|
func Pong(c *gin.Context, status Status, body interface{}) {
|
||||||
|
c.Set("err", status)
|
||||||
c.JSON(http.StatusOK, Wrap(status, body))
|
c.JSON(http.StatusOK, Wrap(status, body))
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,8 @@ func (m *Metrics) Handler() gin.HandlerFunc {
|
|||||||
if !ok {
|
if !ok {
|
||||||
success = false
|
success = false
|
||||||
err = e.Unknown
|
err = e.Unknown
|
||||||
|
} else if err != e.Success {
|
||||||
|
success = false
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Record(method, url, success, status, err, elapsed)
|
m.Record(method, url, success, status, err, elapsed)
|
||||||
|
Loading…
Reference in New Issue
Block a user