mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
Refine TimeRecorder output (#20897)
Signed-off-by: yah01 <yang.cen@zilliz.com> Signed-off-by: yah01 <yang.cen@zilliz.com>
This commit is contained in:
parent
8d78d9943a
commit
18762f82aa
@ -14,10 +14,10 @@ package timerecord
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// TimeRecorder provides methods to record time duration
|
||||
@ -80,15 +80,11 @@ func (tr *TimeRecorder) CtxElapse(ctx context.Context, msg string) time.Duration
|
||||
}
|
||||
|
||||
func (tr *TimeRecorder) printTimeRecord(ctx context.Context, msg string, span time.Duration) {
|
||||
str := ""
|
||||
if tr.header != "" {
|
||||
str += tr.header + ": "
|
||||
}
|
||||
str += msg
|
||||
str += " ("
|
||||
str += strconv.Itoa(int(span.Milliseconds()))
|
||||
str += "ms)"
|
||||
log.Ctx(ctx).Debug(str)
|
||||
log.Ctx(ctx).WithOptions(zap.AddCallerSkip(2)).
|
||||
Debug(fmt.Sprintf("timerecorder %s: record elapsed duration", tr.header),
|
||||
zap.String("msg", msg),
|
||||
zap.Duration("duration", span),
|
||||
)
|
||||
}
|
||||
|
||||
// LongTermChecker checks we receive at least one msg in d duration. If not, checker
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user