mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
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:
@@ -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)",
|
||||
|
||||
Reference in New Issue
Block a user