上报添加traceid
This commit is contained in:
+1
-4
@@ -615,7 +615,7 @@ func (l *Cluster) processTask(taskId string) {
|
|||||||
l.logger.Infof(ctx, "doTask timer begin taskId:%s", taskId)
|
l.logger.Infof(ctx, "doTask timer begin taskId:%s", taskId)
|
||||||
|
|
||||||
// 上报执行情况
|
// 上报执行情况
|
||||||
executeVal := fmt.Sprintf("%s|%s|%s",taskId,l.instanceId,begin.Format(time.RFC3339Nano))
|
executeVal := fmt.Sprintf("%s|%s|%s|%s", taskId, l.instanceId, u.String(), begin.Format(time.RFC3339Nano))
|
||||||
l.redis.ZAdd(ctx, l.executeInfoKey, &redis.Z{
|
l.redis.ZAdd(ctx, l.executeInfoKey, &redis.Z{
|
||||||
Score: float64(begin.UnixMilli()),
|
Score: float64(begin.UnixMilli()),
|
||||||
Member: executeVal,
|
Member: executeVal,
|
||||||
@@ -644,7 +644,6 @@ func (l *Cluster) processTask(taskId string) {
|
|||||||
}
|
}
|
||||||
defer lock.Unlock()
|
defer lock.Unlock()
|
||||||
|
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
l.logger.Errorf(ctx, "doTask timer:回调任务panic err:%+v stack:%s", err, string(debug.Stack()))
|
l.logger.Errorf(ctx, "doTask timer:回调任务panic err:%+v stack:%s", err, string(debug.Stack()))
|
||||||
@@ -653,8 +652,6 @@ func (l *Cluster) processTask(taskId string) {
|
|||||||
l.logger.Infof(ctx, "doTask timer:执行任务耗时:%s %dms", taskId, time.Since(begin).Milliseconds())
|
l.logger.Infof(ctx, "doTask timer:执行任务耗时:%s %dms", taskId, time.Since(begin).Milliseconds())
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 执行任务
|
// 执行任务
|
||||||
if err := t.Callback(ctx, t.ExtendData); err != nil {
|
if err := t.Callback(ctx, t.ExtendData); err != nil {
|
||||||
l.logger.Errorf(ctx, "doTask timer:执行任务失败:%s %+v", taskId, err)
|
l.logger.Errorf(ctx, "doTask timer:执行任务失败:%s %+v", taskId, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user