Recorder追踪函数trace在finish_api文件358行scan函数所在的371行被调用时,BeginAt 没有赋值,默认值0001-0:0:0导致追踪日志显示的sql耗时无限大. (#3657)

Co-authored-by: 张奇峰 <10515935zwj>
This commit is contained in:
qifengzhang007 2020-10-22 14:09:09 +08:00 committed by GitHub
parent 231aba53c5
commit 6d90d09cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ var (
LogLevel: Warn,
Colorful: true,
})
Recorder = traceRecorder{Interface: Default}
Recorder = traceRecorder{Interface: Default, BeginAt: time.Now()}
)
func New(writer Writer, config Config) Interface {
@ -173,7 +173,7 @@ type traceRecorder struct {
}
func (l traceRecorder) New() *traceRecorder {
return &traceRecorder{Interface: l.Interface}
return &traceRecorder{Interface: l.Interface, BeginAt: time.Now()}
}
func (l *traceRecorder) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {