From eecbec986e0922ad77cabeff769a45fce582e107 Mon Sep 17 00:00:00 2001 From: Roman Tsypuk Date: Fri, 23 Jul 2021 20:49:36 +0300 Subject: [PATCH] feat: added segment EndTime check on close to support VirtualSegments(SNS-SQS fanout trace recover) --- xray/segment.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xray/segment.go b/xray/segment.go index 61dcc9e8..11023f4c 100644 --- a/xray/segment.go +++ b/xray/segment.go @@ -347,7 +347,9 @@ func (seg *Segment) Close(err error) { } else { logger.Debugf("Closing segment named %s", seg.Name) } - seg.EndTime = float64(time.Now().UnixNano()) / float64(time.Second) + if seg.EndTime == 0 { + seg.EndTime = float64(time.Now().UnixNano()) / float64(time.Second) + } seg.InProgress = false if err != nil {