请求开始时间设置为毫秒
This commit is contained in:
parent
409120f77d
commit
940d9f327e
@ -28,7 +28,7 @@ func InitRequest(startTimeField string, traceIDField string) gin.HandlerFunc {
|
|||||||
if len(traceIDField) == 0 {
|
if len(traceIDField) == 0 {
|
||||||
traceIDField = "trace_id"
|
traceIDField = "trace_id"
|
||||||
}
|
}
|
||||||
ctx.Set(startTimeField, time.Now().Unix())
|
ctx.Set(startTimeField, time.Now().UnixMilli())
|
||||||
// 设置请求trace_id
|
// 设置请求trace_id
|
||||||
ctx.Set(traceIDField, commonUtil.GetHostIP()+"-"+ctx.ClientIP()+"-"+time.Now().Format("20060102150405")+"-"+commonUtil.Md5(commonUtil.GenRandomString("", 16)))
|
ctx.Set(traceIDField, commonUtil.GetHostIP()+"-"+ctx.ClientIP()+"-"+time.Now().Format("20060102150405")+"-"+commonUtil.Md5(commonUtil.GenRandomString("", 16)))
|
||||||
ctx.Next()
|
ctx.Next()
|
||||||
|
Loading…
Reference in New Issue
Block a user