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.
This commit is contained in:
mlmhl
2020-09-26 02:46:06 +08:00
committed by GitHub
parent 7bf75824bf
commit 3f36143790

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)",