@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.
@@ -251,7 +251,7 @@ function getContextFromScope(scope) {
251
251
 
252
252
  /**
253
253
  *
254
- * @param otelSpan Checks wheter a given OTEL Span is an http request to sentry.
254
+ * @param otelSpan Checks whether a given OTEL Span is an http request to sentry.
255
255
  * @returns boolean
256
256
  */
257
257
  function isSentryRequestSpan(span) {
@@ -1623,8 +1623,9 @@ class SentrySpanExporter {
1623
1623
  * We do this to avoid leaking memory.
1624
1624
  */
1625
1625
  _cleanupOldSpans(spans = this._finishedSpans) {
1626
+ const currentTimeSeconds = Date.now() / 1000;
1626
1627
  this._finishedSpans = spans.filter(span => {
1627
- const shouldDrop = shouldCleanupSpan(span, this._timeout);
1628
+ const shouldDrop = shouldCleanupSpan(span, currentTimeSeconds, this._timeout);
1628
1629
  DEBUG_BUILD &&
1629
1630
  shouldDrop &&
1630
1631
  logger.log(
@@ -1692,8 +1693,8 @@ function getCompletedRootNodes(nodes) {
1692
1693
  return nodes.filter(nodeIsCompletedRootNode);
1693
1694
  }
1694
1695
 
1695
- function shouldCleanupSpan(span, maxStartTimeOffsetSeconds) {
1696
- const cutoff = Date.now() / 1000 - maxStartTimeOffsetSeconds;
1696
+ function shouldCleanupSpan(span, currentTimeSeconds, maxStartTimeOffsetSeconds) {
1697
+ const cutoff = currentTimeSeconds - maxStartTimeOffsetSeconds;
1697
1698
  return spanTimeInputToSeconds(span.startTime) < cutoff;
1698
1699
  }
1699
1700
 
@@ -1726,7 +1727,7 @@ function createTransactionForOtelSpan(span) {
1726
1727
 
1727
1728
  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)]);
1728
1729
 
1729
- // If parentSpanIdFromTraceState is defined at all, we want it to take presedence
1730
+ // If parentSpanIdFromTraceState is defined at all, we want it to take precedence
1730
1731
  // In that case, an empty string should be interpreted as "no parent span id",
1731
1732
  // even if `span.parentSpanId` is set
1732
1733
  // this is the case when we are starting a new trace, where we have a virtual span based on the propagationContext
@@ -1850,7 +1851,7 @@ function getSpanData(span)
1850
1851
  }
1851
1852
 
1852
1853
  /**
1853
- * Remove custom `sentry.` attribtues we do not need to send.
1854
+ * Remove custom `sentry.` attributes we do not need to send.
1854
1855
  * These are more carrier attributes we use inside of the SDK, we do not need to send them to the API.
1855
1856
  */
1856
1857
  function removeSentryAttributes(data) {