File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed
packages/opentelemetry-tracing/src Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,16 @@ export class Span implements types.Span, ReadableSpan {
141141 }
142142 this . _ended = true ;
143143 this . endTime = timeInputToHrTime ( endTime ) ;
144+
145+ this . _duration = hrTimeDuration ( this . startTime , this . endTime ) ;
146+ if ( this . _duration [ 0 ] < 0 ) {
147+ this . _logger . warn (
148+ 'Inconsistent start and end time, startTime > endTime' ,
149+ this . startTime ,
150+ this . endTime
151+ ) ;
152+ }
153+
144154 this . _spanProcessor . onEnd ( this ) ;
145155 }
146156
@@ -153,20 +163,6 @@ export class Span implements types.Span, ReadableSpan {
153163 }
154164
155165 get duration ( ) : types . HrTime {
156- if ( this . _duration [ 0 ] !== - 1 ) {
157- return this . _duration ;
158- }
159-
160- this . _duration = hrTimeDuration ( this . startTime , this . endTime ) ;
161-
162- if ( this . _duration [ 0 ] < 0 ) {
163- this . _logger . warn (
164- 'Inconsistent start and end time, startTime > endTime' ,
165- this . startTime ,
166- this . endTime
167- ) ;
168- }
169-
170166 return this . _duration ;
171167 }
172168
You can’t perform that action at this time.
0 commit comments