@sentry/opentelemetry 8.36.0-beta.0 → 8.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -254,7 +254,7 @@ function getContextFromScope(scope) {
254
254
 
255
255
  /**
256
256
  *
257
- * @param otelSpan Checks wheter a given OTEL Span is an http request to sentry.
257
+ * @param otelSpan Checks whether a given OTEL Span is an http request to sentry.
258
258
  * @returns boolean
259
259
  */
260
260
  function isSentryRequestSpan(span) {
@@ -1626,8 +1626,9 @@ class SentrySpanExporter {
1626
1626
  * We do this to avoid leaking memory.
1627
1627
  */
1628
1628
  _cleanupOldSpans(spans = this._finishedSpans) {
1629
+ const currentTimeSeconds = Date.now() / 1000;
1629
1630
  this._finishedSpans = spans.filter(span => {
1630
- const shouldDrop = shouldCleanupSpan(span, this._timeout);
1631
+ const shouldDrop = shouldCleanupSpan(span, currentTimeSeconds, this._timeout);
1631
1632
  DEBUG_BUILD &&
1632
1633
  shouldDrop &&
1633
1634
  utils.logger.log(
@@ -1695,8 +1696,8 @@ function getCompletedRootNodes(nodes) {
1695
1696
  return nodes.filter(nodeIsCompletedRootNode);
1696
1697
  }
1697
1698
 
1698
- function shouldCleanupSpan(span, maxStartTimeOffsetSeconds) {
1699
- const cutoff = Date.now() / 1000 - maxStartTimeOffsetSeconds;
1699
+ function shouldCleanupSpan(span, currentTimeSeconds, maxStartTimeOffsetSeconds) {
1700
+ const cutoff = currentTimeSeconds - maxStartTimeOffsetSeconds;
1700
1701
  return core.spanTimeInputToSeconds(span.startTime) < cutoff;
1701
1702
  }
1702
1703
 
@@ -1729,7 +1730,7 @@ function createTransactionForOtelSpan(span) {
1729
1730
 
1730
1731
  const parentSpanIdFromTraceState = _optionalChain$2([span, 'access', _2 => _2.spanContext, 'call', _3 => _3(), 'access', _4 => _4.traceState, 'optionalAccess', _5 => _5.get, 'call', _6 => _6(SENTRY_TRACE_STATE_PARENT_SPAN_ID)]);
1731
1732
 
1732
- // If parentSpanIdFromTraceState is defined at all, we want it to take presedence
1733
+ // If parentSpanIdFromTraceState is defined at all, we want it to take precedence
1733
1734
  // In that case, an empty string should be interpreted as "no parent span id",
1734
1735
  // even if `span.parentSpanId` is set
1735
1736
  // this is the case when we are starting a new trace, where we have a virtual span based on the propagationContext
@@ -1853,7 +1854,7 @@ function getSpanData(span)
1853
1854
  }
1854
1855
 
1855
1856
  /**
1856
- * Remove custom `sentry.` attribtues we do not need to send.
1857
+ * Remove custom `sentry.` attributes we do not need to send.
1857
1858
  * These are more carrier attributes we use inside of the SDK, we do not need to send them to the API.
1858
1859
  */
1859
1860
  function removeSentryAttributes(data) {