How to use the @opentelemetry/core.hrTimeDuration function in @opentelemetry/core

To help you get started, we’ve selected a few @opentelemetry/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github open-telemetry / opentelemetry-js / packages / opentelemetry-tracing / src / Span.ts View on Github external
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);
  }