mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 03:42:08 +08:00
api prommetrics
This commit is contained in:
parent
9151b56fe9
commit
c1d66faa10
@ -21,17 +21,15 @@ import (
|
|||||||
|
|
||||||
func prommetricsGin() gin.HandlerFunc {
|
func prommetricsGin() gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
//start := time.Now()
|
|
||||||
c.Next()
|
c.Next()
|
||||||
path := c.FullPath()
|
path := c.FullPath()
|
||||||
prommetrics.HttpCall(path, c.Request.Method, c.Writer.Status())
|
if c.Writer.Status() == http.StatusNotFound {
|
||||||
//prommetrics.HttpCall(path, c.Request.Method, c.Writer.Status(), time.Since(start))
|
prommetrics.HttpCall("<404>", c.Request.Method, c.Writer.Status())
|
||||||
if c.Request.Method == http.MethodPost {
|
|
||||||
if resp := apiresp.GetGinApiResponse(c); resp == nil {
|
|
||||||
prommetrics.APICall(path, -1)
|
|
||||||
} else {
|
} else {
|
||||||
prommetrics.APICall(path, resp.ErrCode)
|
prommetrics.HttpCall(path, c.Request.Method, c.Writer.Status())
|
||||||
}
|
}
|
||||||
|
if resp := apiresp.GetGinApiResponse(c); resp != nil {
|
||||||
|
prommetrics.APICall(path, c.Request.Method, resp.ErrCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user