@sentry/opentelemetry 8.30.0 → 8.31.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.
@@ -3,7 +3,7 @@ import { ATTR_URL_FULL, SEMATTRS_HTTP_URL, ATTR_HTTP_REQUEST_METHOD, SEMATTRS_HT
3
3
  import { parseUrl, getSanitizedUrlString, addNonEnumerableProperty, stripUrlQueryAndFragment, dynamicSamplingContextToSentryBaggageHeader, baggageHeaderToDynamicSamplingContext, LRUMap, logger, parseBaggageHeader, SENTRY_BAGGAGE_KEY_PREFIX, generateSentryTraceHeader, propagationContextFromHeaders, stringMatchesSomePattern, dropUndefinedKeys } from '@sentry/utils';
4
4
  import * as api from '@opentelemetry/api';
5
5
  import { trace, SpanKind, createContextKey, TraceFlags, propagation, INVALID_TRACEID, context, SpanStatusCode, INVALID_SPANID, ROOT_CONTEXT, isSpanContextValid } from '@opentelemetry/api';
6
- import { SDK_VERSION, isSentryRequestUrl, getClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, getDynamicSamplingContextFromSpan, getRootSpan, getCurrentScope, getIsolationScope, hasTracingEnabled, getDynamicSamplingContextFromClient, handleCallbackErrors, continueTrace as continueTrace$1, setAsyncContextStrategy, getDefaultCurrentScope, getDefaultIsolationScope, SPAN_STATUS_OK, SPAN_STATUS_ERROR, getSpanStatusFromHttpCode, timedEventsToMeasurements, captureEvent, spanTimeInputToSeconds, getCapturedScopesOnSpan, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, getStatusMessage, getMetricSummaryJsonForSpan, addChildSpanToSpan, setCapturedScopesOnSpan, logSpanStart, logSpanEnd, sampleSpan } from '@sentry/core';
6
+ import { SDK_VERSION, isSentryRequestUrl, getClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, getDynamicSamplingContextFromSpan, getRootSpan, getCurrentScope, getIsolationScope, getDynamicSamplingContextFromClient, handleCallbackErrors, continueTrace as continueTrace$1, setAsyncContextStrategy, getDefaultCurrentScope, getDefaultIsolationScope, SPAN_STATUS_OK, SPAN_STATUS_ERROR, getSpanStatusFromHttpCode, timedEventsToMeasurements, captureEvent, spanTimeInputToSeconds, getCapturedScopesOnSpan, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, getStatusMessage, getMetricSummaryJsonForSpan, addChildSpanToSpan, setCapturedScopesOnSpan, logSpanStart, logSpanEnd, hasTracingEnabled, sampleSpan } from '@sentry/core';
7
7
  export { getClient, getCurrentHubShim, getDynamicSamplingContextFromSpan } from '@sentry/core';
8
8
  import { TraceState, W3CBaggagePropagator, isTracingSuppressed, suppressTracing as suppressTracing$1 } from '@opentelemetry/core';
9
9
  import { SamplingDecision } from '@opentelemetry/sdk-trace-base';
@@ -379,6 +379,11 @@ function descriptionForHttpMethod(
379
379
  break;
380
380
  }
381
381
 
382
+ // Spans for HTTP requests we have determined to be prefetch requests will have a `.prefetch` postfix in the op
383
+ if (attributes['sentry.http.prefetch']) {
384
+ opParts.push('prefetch');
385
+ }
386
+
382
387
  const { urlPath, url, query, fragment, hasRoute } = getSanitizedUrl(attributes, kind);
383
388
 
384
389
  if (!urlPath) {
@@ -783,7 +788,7 @@ class SentryPropagator extends W3CBaggagePropagator {
783
788
  function getInjectionData(context)
784
789
 
785
790
  {
786
- const span = hasTracingEnabled() ? trace.getSpan(context) : undefined;
791
+ const span = trace.getSpan(context);
787
792
  const spanIsRemote = _optionalChain$6([span, 'optionalAccess', _5 => _5.spanContext, 'call', _6 => _6(), 'access', _7 => _7.isRemote]);
788
793
 
789
794
  // If we have a local span, we can just pick everything from it
@@ -1867,6 +1872,7 @@ function removeSentryAttributes(data) {
1867
1872
  /* eslint-disable @typescript-eslint/no-dynamic-delete */
1868
1873
  delete cleanedData[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE];
1869
1874
  delete cleanedData[SEMANTIC_ATTRIBUTE_SENTRY_PARENT_IS_REMOTE];
1875
+ delete cleanedData['sentry.skip_span_data_inference'];
1870
1876
  /* eslint-enable @typescript-eslint/no-dynamic-delete */
1871
1877
 
1872
1878
  return cleanedData;