pkg/traceutil: skip subTraceStart/subTraceEnd steps when logging steps (#12262)

SubTraceStart and SubTraceEnd steps are only placeholders, not really
steps, we should skip them when logging the long duration steps,
otherwise these steps will lead to incorrect start time and duration
 of subsequent steps.
release-3.5
mlmhl 2020-09-26 02:46:06 +08:00 committed by GitHub
parent 7bf75824bf
commit 3f36143790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -192,6 +192,9 @@ func (t *Trace) logInfo(threshold time.Duration) (string, []zap.Field) {
}
for i := 0; i < len(t.steps); i++ {
step := t.steps[i]
if step.isSubTraceStart || step.isSubTraceEnd {
continue
}
stepDuration := step.time.Sub(lastStepTime)
if stepDuration > threshold {
steps = append(steps, fmt.Sprintf("trace[%d] '%v' %s (duration: %v)",