回调的ctx添加trace_id

This commit is contained in:
Yun
2024-05-28 17:28:20 +08:00
parent e070933e41
commit 2cc97438b4
6 changed files with 26 additions and 3 deletions
+5
View File
@@ -8,6 +8,8 @@ import (
"runtime/debug"
"sync"
"time"
uuid "github.com/satori/go.uuid"
)
// 简单定时器
@@ -283,5 +285,8 @@ func (s *Single) doTask(ctx context.Context, call callback, extend interface{})
s.logger.Errorf(ctx, "timer:定时器出错 err:%+v stack:%s", err, string(debug.Stack()))
}
}()
ctx = context.WithValue(ctx, "trace_id", uuid.NewV4().String)
return call(ctx, extend)
}