Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
end(endTime: types.TimeInput = hrTime()): void {
if (this._isSpanEnded()) {
this._logger.error('You can only call end() on a span once.');
return;
}
this._ended = true;
this.endTime = timeInputToHrTime(endTime);
this._duration = hrTimeDuration(this.startTime, this.endTime);
if (this._duration[0] < 0) {
this._logger.warn(
'Inconsistent start and end time, startTime > endTime',
this.startTime,
this.endTime
);
}
this._spanProcessor.onEnd(this);
}