提交 5fa39fc9 authored 作者: mooncake9527's avatar mooncake9527

fix metrics

上级 edffc566
......@@ -220,7 +220,7 @@ func Logging(opts ...Option) gin.HandlerFunc {
reqID = c.Request.Header.Get(ctxUtils.HeaderXRequestIDKey)
fields = append(fields, zap.String(ctxUtils.ContextTraceIDKey, reqID))
}
o.log.Info("<<<<<<<<<req", fields...)
o.log.Info("[middleware][logging]<<<<<<<<<req", fields...)
c.Request.Body = io.NopCloser(buf)
......@@ -263,7 +263,7 @@ func Logging(opts ...Option) gin.HandlerFunc {
fields = append(fields, zap.String(ctxUtils.ContextTraceIDKey, reqID))
}
o.log.Info(">>>>>>>>>rsp", fields...)
o.log.Info("[middleware][logging]>>>>>>>>>rsp", fields...)
}
}
......@@ -283,13 +283,14 @@ func SimpleLog(opts ...Option) gin.HandlerFunc {
}
reqID := ""
if o.traceIDFrom == 1 {
switch o.traceIDFrom {
case 1:
if v, isExist := c.Get(ctxUtils.ContextTraceIDKey); isExist {
if requestID, ok := v.(string); ok {
reqID = requestID
}
}
} else if o.traceIDFrom == 2 {
case 2:
reqID = c.Request.Header.Get(ctxUtils.HeaderXRequestIDKey)
}
......@@ -307,6 +308,6 @@ func SimpleLog(opts ...Option) gin.HandlerFunc {
if reqID != "" {
fields = append(fields, zap.String(ctxUtils.ContextTraceIDKey, reqID))
}
o.log.Info("Gin msg", fields...)
o.log.Info("[middleware][logging]]>>>>>>>>>rsp", fields...)
}
}
......@@ -15,7 +15,7 @@ import (
"gitlab.wanzhuangkj.com/tush/xpkg/consts"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/handlerfunc"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/middleware"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/middleware/metrics"
metrics "gitlab.wanzhuangkj.com/tush/xpkg/gin/middleware/metrics_wz"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/prof"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/validator"
"gitlab.wanzhuangkj.com/tush/xpkg/pkg/errcode"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论