@sentry/browser 10.50.0 → 10.52.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.
Files changed (49) hide show
  1. package/build/npm/cjs/dev/index.js +1 -0
  2. package/build/npm/cjs/dev/index.js.map +1 -1
  3. package/build/npm/cjs/dev/integrations/culturecontext.js +2 -3
  4. package/build/npm/cjs/dev/integrations/culturecontext.js.map +1 -1
  5. package/build/npm/cjs/dev/integrations/httpcontext.js +16 -0
  6. package/build/npm/cjs/dev/integrations/httpcontext.js.map +1 -1
  7. package/build/npm/cjs/dev/integrations/spotlight.js +7 -18
  8. package/build/npm/cjs/dev/integrations/spotlight.js.map +1 -1
  9. package/build/npm/cjs/dev/tracing/request.js +5 -3
  10. package/build/npm/cjs/dev/tracing/request.js.map +1 -1
  11. package/build/npm/cjs/prod/index.js +1 -0
  12. package/build/npm/cjs/prod/index.js.map +1 -1
  13. package/build/npm/cjs/prod/integrations/culturecontext.js +2 -3
  14. package/build/npm/cjs/prod/integrations/culturecontext.js.map +1 -1
  15. package/build/npm/cjs/prod/integrations/httpcontext.js +16 -0
  16. package/build/npm/cjs/prod/integrations/httpcontext.js.map +1 -1
  17. package/build/npm/cjs/prod/integrations/spotlight.js +7 -18
  18. package/build/npm/cjs/prod/integrations/spotlight.js.map +1 -1
  19. package/build/npm/cjs/prod/tracing/request.js +5 -3
  20. package/build/npm/cjs/prod/tracing/request.js.map +1 -1
  21. package/build/npm/esm/dev/index.js +1 -1
  22. package/build/npm/esm/dev/integrations/culturecontext.js +3 -4
  23. package/build/npm/esm/dev/integrations/culturecontext.js.map +1 -1
  24. package/build/npm/esm/dev/integrations/httpcontext.js +17 -1
  25. package/build/npm/esm/dev/integrations/httpcontext.js.map +1 -1
  26. package/build/npm/esm/dev/integrations/spotlight.js +7 -18
  27. package/build/npm/esm/dev/integrations/spotlight.js.map +1 -1
  28. package/build/npm/esm/dev/package.json +1 -1
  29. package/build/npm/esm/dev/tracing/request.js +5 -3
  30. package/build/npm/esm/dev/tracing/request.js.map +1 -1
  31. package/build/npm/esm/prod/index.js +1 -1
  32. package/build/npm/esm/prod/integrations/culturecontext.js +3 -4
  33. package/build/npm/esm/prod/integrations/culturecontext.js.map +1 -1
  34. package/build/npm/esm/prod/integrations/httpcontext.js +17 -1
  35. package/build/npm/esm/prod/integrations/httpcontext.js.map +1 -1
  36. package/build/npm/esm/prod/integrations/spotlight.js +7 -18
  37. package/build/npm/esm/prod/integrations/spotlight.js.map +1 -1
  38. package/build/npm/esm/prod/package.json +1 -1
  39. package/build/npm/esm/prod/tracing/request.js +5 -3
  40. package/build/npm/esm/prod/tracing/request.js.map +1 -1
  41. package/build/npm/types/index.d.ts +1 -1
  42. package/build/npm/types/index.d.ts.map +1 -1
  43. package/build/npm/types/integrations/culturecontext.d.ts.map +1 -1
  44. package/build/npm/types/integrations/httpcontext.d.ts.map +1 -1
  45. package/build/npm/types/integrations/spotlight.d.ts +4 -5
  46. package/build/npm/types/integrations/spotlight.d.ts.map +1 -1
  47. package/build/npm/types-ts3.8/index.d.ts +1 -1
  48. package/build/npm/types-ts3.8/integrations/spotlight.d.ts +4 -5
  49. package/package.json +7 -7
@@ -4,6 +4,8 @@ import { DEBUG_BUILD } from '../debug-build.js';
4
4
 
5
5
  const INTEGRATION_NAME = 'SpotlightBrowser';
6
6
 
7
+ const SPOTLIGHT_IGNORE_SPANS = [{ op: 'ui.interaction.click', name: '#sentry-spotlight' }];
8
+
7
9
  const _spotlightIntegration = ((options = {}) => {
8
10
  const sidecarUrl = options.sidecarUrl || 'http://localhost:8969/stream';
9
11
 
@@ -12,10 +14,10 @@ const _spotlightIntegration = ((options = {}) => {
12
14
  setup: () => {
13
15
  DEBUG_BUILD && debug.log('Using Sidecar URL', sidecarUrl);
14
16
  },
15
- // We don't want to send interaction transactions/root spans created from
16
- // clicks within Spotlight to Sentry. Neither do we want them to be sent to
17
- // spotlight.
18
- processEvent: event => (isSpotlightInteraction(event) ? null : event),
17
+ beforeSetup(client) {
18
+ const opts = client.getOptions();
19
+ opts.ignoreSpans = [...(opts.ignoreSpans || []), ...SPOTLIGHT_IGNORE_SPANS];
20
+ },
19
21
  afterAllSetup: (client) => {
20
22
  setupSidecarForwarding(client, sidecarUrl);
21
23
  },
@@ -64,18 +66,5 @@ function setupSidecarForwarding(client, sidecarUrl) {
64
66
  */
65
67
  const spotlightBrowserIntegration = defineIntegration(_spotlightIntegration);
66
68
 
67
- /**
68
- * Flags if the event is a transaction created from an interaction with the spotlight UI.
69
- */
70
- function isSpotlightInteraction(event) {
71
- return Boolean(
72
- event.type === 'transaction' &&
73
- event.spans &&
74
- event.contexts?.trace &&
75
- event.contexts.trace.op === 'ui.action.click' &&
76
- event.spans.some(({ description }) => description?.includes('#sentry-spotlight')),
77
- );
78
- }
79
-
80
- export { INTEGRATION_NAME, isSpotlightInteraction, spotlightBrowserIntegration };
69
+ export { INTEGRATION_NAME, SPOTLIGHT_IGNORE_SPANS, spotlightBrowserIntegration };
81
70
  //# sourceMappingURL=spotlight.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spotlight.js","sources":["../../../../../src/integrations/spotlight.ts"],"sourcesContent":["import type { Client, Envelope, Event, IntegrationFn } from '@sentry/core';\nimport { debug, defineIntegration, serializeEnvelope } from '@sentry/core';\nimport { getNativeImplementation } from '@sentry-internal/browser-utils';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { WINDOW } from '../helpers';\n\nexport type SpotlightConnectionOptions = {\n /**\n * Set this if the Spotlight Sidecar is not running on localhost:8969\n * By default, the Url is set to http://localhost:8969/stream\n */\n sidecarUrl?: string;\n};\n\nexport const INTEGRATION_NAME = 'SpotlightBrowser';\n\nconst _spotlightIntegration = ((options: Partial<SpotlightConnectionOptions> = {}) => {\n const sidecarUrl = options.sidecarUrl || 'http://localhost:8969/stream';\n\n return {\n name: INTEGRATION_NAME,\n setup: () => {\n DEBUG_BUILD && debug.log('Using Sidecar URL', sidecarUrl);\n },\n // We don't want to send interaction transactions/root spans created from\n // clicks within Spotlight to Sentry. Neither do we want them to be sent to\n // spotlight.\n processEvent: event => (isSpotlightInteraction(event) ? null : event),\n afterAllSetup: (client: Client) => {\n setupSidecarForwarding(client, sidecarUrl);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction setupSidecarForwarding(client: Client, sidecarUrl: string): void {\n const makeFetch: typeof WINDOW.fetch | undefined = getNativeImplementation('fetch');\n let failCount = 0;\n\n client.on('beforeEnvelope', (envelope: Envelope) => {\n if (failCount > 3) {\n debug.warn('[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:', failCount);\n return;\n }\n\n makeFetch(sidecarUrl, {\n method: 'POST',\n body: serializeEnvelope(envelope),\n headers: {\n 'Content-Type': 'application/x-sentry-envelope',\n },\n mode: 'cors',\n }).then(\n res => {\n if (res.status >= 200 && res.status < 400) {\n // Reset failed requests counter on success\n failCount = 0;\n }\n },\n err => {\n failCount++;\n debug.error(\n \"Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/\",\n err,\n );\n },\n );\n });\n}\n\n/**\n * Use this integration to send errors and transactions to Spotlight.\n *\n * Learn more about spotlight at https://spotlightjs.com\n */\nexport const spotlightBrowserIntegration = defineIntegration(_spotlightIntegration);\n\n/**\n * Flags if the event is a transaction created from an interaction with the spotlight UI.\n */\nexport function isSpotlightInteraction(event: Event): boolean {\n return Boolean(\n event.type === 'transaction' &&\n event.spans &&\n event.contexts?.trace &&\n event.contexts.trace.op === 'ui.action.click' &&\n event.spans.some(({ description }) => description?.includes('#sentry-spotlight')),\n );\n}\n"],"names":[],"mappings":";;;;AAcO,MAAM,gBAAA,GAAmB;;AAEhC,MAAM,qBAAA,IAAyB,CAAC,OAAO,GAAwC,EAAE,KAAK;AACtF,EAAE,MAAM,UAAA,GAAa,OAAO,CAAC,UAAA,IAAc,8BAA8B;;AAEzE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,EAAE,MAAM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,MAAM,CAAC;AACP,KAAK;AACL,EAAE,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;MACa,2BAAA,GAA8B,iBAAiB,CAAC,qBAAqB;;AAElF;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,KAAK,EAAkB;AAC9D,EAAE,OAAO,OAAO;AAChB,IAAI,KAAK,CAAC,IAAA,KAAS,aAAA;AACnB,IAAI,KAAK,CAAC,KAAA;AACV,IAAI,KAAK,CAAC,QAAQ,EAAE,KAAA;AACpB,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAA,KAAO,iBAAA;AAChC,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,WAAA,EAAa,KAAK,WAAW,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AACrF,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"spotlight.js","sources":["../../../../../src/integrations/spotlight.ts"],"sourcesContent":["import type { Client, Envelope, IntegrationFn } from '@sentry/core';\nimport { debug, defineIntegration, serializeEnvelope } from '@sentry/core';\nimport { getNativeImplementation } from '@sentry-internal/browser-utils';\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { WINDOW } from '../helpers';\n\nexport type SpotlightConnectionOptions = {\n /**\n * Set this if the Spotlight Sidecar is not running on localhost:8969\n * By default, the Url is set to http://localhost:8969/stream\n */\n sidecarUrl?: string;\n};\n\nexport const INTEGRATION_NAME = 'SpotlightBrowser';\n\nexport const SPOTLIGHT_IGNORE_SPANS = [{ op: 'ui.interaction.click', name: '#sentry-spotlight' }];\n\nconst _spotlightIntegration = ((options: Partial<SpotlightConnectionOptions> = {}) => {\n const sidecarUrl = options.sidecarUrl || 'http://localhost:8969/stream';\n\n return {\n name: INTEGRATION_NAME,\n setup: () => {\n DEBUG_BUILD && debug.log('Using Sidecar URL', sidecarUrl);\n },\n beforeSetup(client: Client) {\n const opts = client.getOptions();\n opts.ignoreSpans = [...(opts.ignoreSpans || []), ...SPOTLIGHT_IGNORE_SPANS];\n },\n afterAllSetup: (client: Client) => {\n setupSidecarForwarding(client, sidecarUrl);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction setupSidecarForwarding(client: Client, sidecarUrl: string): void {\n const makeFetch: typeof WINDOW.fetch | undefined = getNativeImplementation('fetch');\n let failCount = 0;\n\n client.on('beforeEnvelope', (envelope: Envelope) => {\n if (failCount > 3) {\n debug.warn('[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:', failCount);\n return;\n }\n\n makeFetch(sidecarUrl, {\n method: 'POST',\n body: serializeEnvelope(envelope),\n headers: {\n 'Content-Type': 'application/x-sentry-envelope',\n },\n mode: 'cors',\n }).then(\n res => {\n if (res.status >= 200 && res.status < 400) {\n // Reset failed requests counter on success\n failCount = 0;\n }\n },\n err => {\n failCount++;\n debug.error(\n \"Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/\",\n err,\n );\n },\n );\n });\n}\n\n/**\n * Use this integration to send errors and transactions to Spotlight.\n *\n * Learn more about spotlight at https://spotlightjs.com\n */\nexport const spotlightBrowserIntegration = defineIntegration(_spotlightIntegration);\n"],"names":[],"mappings":";;;;AAcO,MAAM,gBAAA,GAAmB;;AAEzB,MAAM,sBAAA,GAAyB,CAAC,EAAE,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,mBAAA,EAAqB;;AAEhG,MAAM,qBAAA,IAAyB,CAAC,OAAO,GAAwC,EAAE,KAAK;AACtF,EAAE,MAAM,UAAA,GAAa,OAAO,CAAC,UAAA,IAAc,8BAA8B;;AAEzE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,EAAE,MAAM;AACjB,MAAM,WAAA,IAAe,KAAK,CAAC,GAAG,CAAC,mBAAmB,EAAE,UAAU,CAAC;AAC/D,IAAI,CAAC;AACL,IAAI,WAAW,CAAC,MAAM,EAAU;AAChC,MAAM,MAAM,IAAA,GAAO,MAAM,CAAC,UA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;AACA;AACA;AACA;MACa,2BAAA,GAA8B,iBAAiB,CAAC,qBAAqB;;;;"}
@@ -1 +1 @@
1
- {"type":"module","version":"10.50.0","sideEffects":false}
1
+ {"type":"module","version":"10.52.0","sideEffects":false}
@@ -287,9 +287,11 @@ function xhrCallback(
287
287
 
288
288
  const client = getClient();
289
289
  const hasParent = !!getActiveSpan();
290
+ // With span streaming, we always emit http.client spans, even without a parent span
291
+ const shouldEmitSpan = hasParent || (!!client && hasSpanStreamingEnabled(client));
290
292
 
291
293
  const span =
292
- shouldCreateSpanResult && hasParent
294
+ shouldCreateSpanResult && shouldEmitSpan
293
295
  ? startInactiveSpan({
294
296
  name: `${method} ${urlForSpanName}`,
295
297
  attributes: {
@@ -306,7 +308,7 @@ function xhrCallback(
306
308
  })
307
309
  : new SentryNonRecordingSpan();
308
310
 
309
- if (shouldCreateSpanResult && !hasParent) {
311
+ if (shouldCreateSpanResult && !shouldEmitSpan) {
310
312
  client?.recordDroppedEvent('no_parent_span', 'span');
311
313
  }
312
314
 
@@ -319,7 +321,7 @@ function xhrCallback(
319
321
  // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction),
320
322
  // we do not want to use the span as base for the trace headers,
321
323
  // which means that the headers will be generated from the scope and the sampling decision is deferred
322
- hasSpansEnabled() && hasParent ? span : undefined,
324
+ hasSpansEnabled() && shouldEmitSpan ? span : undefined,
323
325
  propagateTraceparent,
324
326
  );
325
327
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sources":["../../../../../src/tracing/request.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type {\n Client,\n HandlerDataXhr,\n RequestHookInfo,\n ResponseHookInfo,\n SentryWrappedXMLHttpRequest,\n Span,\n SpanTimeInput,\n} from '@sentry/core';\nimport {\n addFetchEndInstrumentationHandler,\n addFetchInstrumentationHandler,\n getActiveSpan,\n getClient,\n getLocationHref,\n getTraceData,\n hasSpansEnabled,\n hasSpanStreamingEnabled,\n instrumentFetchRequest,\n parseUrl,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n setHttpStatus,\n spanToJSON,\n startInactiveSpan,\n stringMatchesSomePattern,\n stripDataUrlContent,\n stripUrlQueryAndFragment,\n timestampInSeconds,\n} from '@sentry/core';\nimport type { XhrHint } from '@sentry-internal/browser-utils';\nimport {\n addPerformanceInstrumentationHandler,\n addXhrInstrumentationHandler,\n parseXhrResponseHeaders,\n resourceTimingToSpanAttributes,\n SENTRY_XHR_DATA_KEY,\n} from '@sentry-internal/browser-utils';\nimport type { BrowserClient } from '../client';\nimport { baggageHeaderHasSentryValues, createHeadersSafely, getFullURL, isPerformanceResourceTiming } from './utils';\n\n/** Options for Request Instrumentation */\nexport interface RequestInstrumentationOptions {\n /**\n * List of strings and/or Regular Expressions used to determine which outgoing requests will have `sentry-trace` and `baggage`\n * headers attached.\n *\n * **Default:** If this option is not provided, tracing headers will be attached to all outgoing requests.\n * If you are using a browser SDK, by default, tracing headers will only be attached to outgoing requests to the same origin.\n *\n * **Disclaimer:** Carelessly setting this option in browser environments may result into CORS errors!\n * Only attach tracing headers to requests to the same origin, or to requests to services you can control CORS headers of.\n * Cross-origin requests, meaning requests to a different domain, for example a request to `https://api.example.com/` while you're on `https://example.com/`, take special care.\n * If you are attaching headers to cross-origin requests, make sure the backend handling the request returns a `\"Access-Control-Allow-Headers: sentry-trace, baggage\"` header to ensure your requests aren't blocked.\n *\n * If you provide a `tracePropagationTargets` array, the entries you provide will be matched against the entire URL of the outgoing request.\n * If you are using a browser SDK, the entries will also be matched against the pathname of the outgoing requests.\n * This is so you can have matchers for relative requests, for example, `/^\\/api/` if you want to trace requests to your `/api` routes on the same domain.\n *\n * If any of the two match any of the provided values, tracing headers will be attached to the outgoing request.\n * Both, the string values, and the RegExes you provide in the array will match if they partially match the URL or pathname.\n *\n * Examples:\n * - `tracePropagationTargets: [/^\\/api/]` and request to `https://same-origin.com/api/posts`:\n * - Tracing headers will be attached because the request is sent to the same origin and the regex matches the pathname \"/api/posts\".\n * - `tracePropagationTargets: [/^\\/api/]` and request to `https://different-origin.com/api/posts`:\n * - Tracing headers will not be attached because the pathname will only be compared when the request target lives on the same origin.\n * - `tracePropagationTargets: [/^\\/api/, 'https://external-api.com']` and request to `https://external-api.com/v1/data`:\n * - Tracing headers will be attached because the request URL matches the string `'https://external-api.com'`.\n */\n tracePropagationTargets?: Array<string | RegExp>;\n\n /**\n * Flag to disable patching all together for fetch requests.\n *\n * Default: true\n */\n traceFetch: boolean;\n\n /**\n * Flag to disable patching all together for xhr requests.\n *\n * Default: true\n */\n traceXHR: boolean;\n\n /**\n * Flag to disable tracking of long-lived streams, like server-sent events (SSE) via fetch.\n * Do not enable this in case you have live streams or very long running streams.\n *\n * Disabled by default since it can lead to issues with streams using the `cancel()` api\n * (https://github.com/getsentry/sentry-javascript/issues/13950)\n *\n * Default: false\n */\n trackFetchStreamPerformance: boolean;\n\n /**\n * If true, Sentry will capture http timings and add them to the corresponding http spans.\n *\n * Default: true\n */\n enableHTTPTimings: boolean;\n\n /**\n * This function will be called before creating a span for a request with the given url.\n * Return false if you don't want a span for the given url.\n *\n * Default: (url: string) => true\n */\n shouldCreateSpanForRequest?(this: void, url: string): boolean;\n\n /**\n * Is called when spans are started for outgoing requests.\n */\n onRequestSpanStart?(span: Span, requestInformation: RequestHookInfo): void;\n\n /**\n * Is called when spans end for outgoing requests, providing access to response headers.\n */\n onRequestSpanEnd?(span: Span, responseInformation: ResponseHookInfo): void;\n}\n\nconst responseToSpanId = new WeakMap<object, string>();\nconst spanIdToEndTimestamp = new Map<string, number>();\n\nexport const defaultRequestInstrumentationOptions: RequestInstrumentationOptions = {\n traceFetch: true,\n traceXHR: true,\n enableHTTPTimings: true,\n trackFetchStreamPerformance: false,\n};\n\n/** Registers span creators for xhr and fetch requests */\nexport function instrumentOutgoingRequests(client: Client, _options?: Partial<RequestInstrumentationOptions>): void {\n const {\n traceFetch,\n traceXHR,\n trackFetchStreamPerformance,\n shouldCreateSpanForRequest,\n enableHTTPTimings,\n tracePropagationTargets,\n onRequestSpanStart,\n onRequestSpanEnd,\n } = {\n ...defaultRequestInstrumentationOptions,\n ..._options,\n };\n\n const shouldCreateSpan =\n typeof shouldCreateSpanForRequest === 'function' ? shouldCreateSpanForRequest : (_: string) => true;\n\n const shouldAttachHeadersWithTargets = (url: string): boolean => shouldAttachHeaders(url, tracePropagationTargets);\n\n const spans: Record<string, Span> = {};\n\n const propagateTraceparent = (client as BrowserClient).getOptions().propagateTraceparent;\n\n if (traceFetch) {\n // Keeping track of http requests, whose body payloads resolved later than the initial resolved request\n // e.g. streaming using server sent events (SSE)\n client.addEventProcessor(event => {\n if (event.type === 'transaction' && event.spans) {\n event.spans.forEach(span => {\n if (span.op === 'http.client') {\n const updatedTimestamp = spanIdToEndTimestamp.get(span.span_id);\n if (updatedTimestamp) {\n span.timestamp = updatedTimestamp / 1000;\n spanIdToEndTimestamp.delete(span.span_id);\n }\n }\n });\n }\n return event;\n });\n\n if (trackFetchStreamPerformance) {\n addFetchEndInstrumentationHandler(handlerData => {\n if (handlerData.response) {\n const span = responseToSpanId.get(handlerData.response);\n if (span && handlerData.endTimestamp) {\n spanIdToEndTimestamp.set(span, handlerData.endTimestamp);\n }\n }\n });\n }\n\n addFetchInstrumentationHandler(handlerData => {\n const createdSpan = instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans, {\n propagateTraceparent,\n onRequestSpanEnd,\n });\n\n if (handlerData.response && handlerData.fetchData.__span) {\n responseToSpanId.set(handlerData.response, handlerData.fetchData.__span);\n }\n\n // We cannot use `window.location` in the generic fetch instrumentation,\n // but we need it for reliable `server.address` attribute.\n // so we extend this in here\n if (createdSpan) {\n const fullUrl = getFullURL(handlerData.fetchData.url);\n const host = fullUrl ? parseUrl(fullUrl).host : undefined;\n createdSpan.setAttributes({\n 'http.url': fullUrl ? stripDataUrlContent(fullUrl) : undefined,\n 'server.address': host,\n });\n\n if (enableHTTPTimings) {\n addHTTPTimings(createdSpan, client);\n }\n\n onRequestSpanStart?.(createdSpan, { headers: handlerData.headers });\n }\n });\n }\n\n if (traceXHR) {\n addXhrInstrumentationHandler(handlerData => {\n const createdSpan = xhrCallback(\n handlerData,\n shouldCreateSpan,\n shouldAttachHeadersWithTargets,\n spans,\n propagateTraceparent,\n onRequestSpanEnd,\n );\n\n if (createdSpan) {\n if (enableHTTPTimings) {\n addHTTPTimings(createdSpan, client);\n }\n\n onRequestSpanStart?.(createdSpan, {\n headers: createHeadersSafely(handlerData.xhr.__sentry_xhr_v3__?.request_headers),\n });\n }\n });\n }\n}\n\n/**\n * The maximum time (ms) to wait for PerformanceResourceTiming data before ending the span.\n * Same approach is used by OTel's browser fetch instrumentation:\n * See {@link https://github.com/open-telemetry/opentelemetry-js/blob/30f94fe99339287b1e4d3c8bb90172c2523f06f4/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts#L352-L372}\n */\nconst HTTP_TIMING_WAIT_MS = 300;\n\n/**\n * Creates a temporary observer to listen to the next fetch/xhr resourcing timings,\n * so that when timings hit their per-browser limit they don't need to be removed.\n *\n * @param span A span that has yet to be finished, must contain `url` on data.\n */\nfunction addHTTPTimings(span: Span, client: Client): void {\n const { url } = spanToJSON(span).data;\n\n if (!url || typeof url !== 'string') {\n return;\n }\n\n // Clean up the performance observer and other resources\n // We have to wait here because otherwise this cleans itself up before it is fully done.\n // Default (non-streaming): just deregister the observer.\n let onEntryFound = (): void => void setTimeout(unsubscribePerformanceObsever);\n\n // For streamed spans, we have to artificially delay the ending of the span until we\n // either receive the timing data, or HTTP_TIMING_WAIT_MS elapses.\n if (hasSpanStreamingEnabled(client)) {\n const originalEnd = span.end.bind(span);\n\n span.end = (endTimestamp?: SpanTimeInput) => {\n const capturedEndTimestamp = endTimestamp ?? timestampInSeconds();\n let isEnded = false;\n\n const endSpanAndCleanup = (): void => {\n if (isEnded) {\n return;\n }\n isEnded = true;\n setTimeout(unsubscribePerformanceObsever);\n originalEnd(capturedEndTimestamp);\n clearTimeout(fallbackTimeout);\n };\n\n onEntryFound = endSpanAndCleanup;\n\n // Fallback: always end the span after HTTP_TIMING_WAIT_MS even if no\n // PerformanceResourceTiming entry arrives (e.g. cross-origin without\n // Timing-Allow-Origin, or the browser didn't fire the observer in time).\n const fallbackTimeout = setTimeout(endSpanAndCleanup, HTTP_TIMING_WAIT_MS);\n };\n }\n\n const unsubscribePerformanceObsever = addPerformanceInstrumentationHandler('resource', ({ entries }) => {\n entries.forEach(entry => {\n if (isPerformanceResourceTiming(entry) && entry.name.endsWith(url)) {\n span.setAttributes(resourceTimingToSpanAttributes(entry));\n onEntryFound();\n }\n });\n });\n}\n\n/**\n * A function that determines whether to attach tracing headers to a request.\n * We only export this function for testing purposes.\n */\nexport function shouldAttachHeaders(\n targetUrl: string,\n tracePropagationTargets: (string | RegExp)[] | undefined,\n): boolean {\n // window.location.href not being defined is an edge case in the browser but we need to handle it.\n // Potentially dangerous situations where it may not be defined: Browser Extensions, Web Workers, patching of the location obj\n const href = getLocationHref();\n\n if (!href) {\n // If there is no window.location.origin, we default to only attaching tracing headers to relative requests, i.e. ones that start with `/`\n // BIG DISCLAIMER: Users can call URLs with a double slash (fetch(\"//example.com/api\")), this is a shorthand for \"send to the same protocol\",\n // so we need a to exclude those requests, because they might be cross origin.\n const isRelativeSameOriginRequest = !!targetUrl.match(/^\\/(?!\\/)/);\n if (!tracePropagationTargets) {\n return isRelativeSameOriginRequest;\n } else {\n return stringMatchesSomePattern(targetUrl, tracePropagationTargets);\n }\n } else {\n let resolvedUrl;\n let currentOrigin;\n\n // URL parsing may fail, we default to not attaching trace headers in that case.\n try {\n resolvedUrl = new URL(targetUrl, href);\n currentOrigin = new URL(href).origin;\n } catch {\n return false;\n }\n\n const isSameOriginRequest = resolvedUrl.origin === currentOrigin;\n if (!tracePropagationTargets) {\n return isSameOriginRequest;\n } else {\n return (\n stringMatchesSomePattern(resolvedUrl.toString(), tracePropagationTargets) ||\n (isSameOriginRequest && stringMatchesSomePattern(resolvedUrl.pathname, tracePropagationTargets))\n );\n }\n }\n}\n\n/**\n * Create and track xhr request spans\n *\n * @returns Span if a span was created, otherwise void.\n */\nfunction xhrCallback(\n handlerData: HandlerDataXhr,\n shouldCreateSpan: (url: string) => boolean,\n shouldAttachHeaders: (url: string) => boolean,\n spans: Record<string, Span>,\n propagateTraceparent?: boolean,\n onRequestSpanEnd?: RequestInstrumentationOptions['onRequestSpanEnd'],\n): Span | undefined {\n const xhr = handlerData.xhr;\n const sentryXhrData = xhr?.[SENTRY_XHR_DATA_KEY];\n\n if (!xhr || xhr.__sentry_own_request__ || !sentryXhrData) {\n return undefined;\n }\n\n const { url, method } = sentryXhrData;\n\n const shouldCreateSpanResult = hasSpansEnabled() && shouldCreateSpan(url);\n\n // Handle XHR completion - clean up spans from the record\n if (handlerData.endTimestamp) {\n const spanId = xhr.__sentry_xhr_span_id__;\n if (!spanId) return;\n\n const span = spans[spanId];\n\n if (span) {\n if (shouldCreateSpanResult && sentryXhrData.status_code !== undefined) {\n setHttpStatus(span, sentryXhrData.status_code);\n span.end();\n\n onRequestSpanEnd?.(span, {\n headers: createHeadersSafely(parseXhrResponseHeaders(xhr as XMLHttpRequest & SentryWrappedXMLHttpRequest)),\n error: handlerData.error,\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete spans[spanId];\n }\n\n return undefined;\n }\n\n const fullUrl = getFullURL(url);\n const parsedUrl = fullUrl ? parseUrl(fullUrl) : parseUrl(url);\n\n const urlForSpanName = stripDataUrlContent(stripUrlQueryAndFragment(url));\n\n const client = getClient();\n const hasParent = !!getActiveSpan();\n\n const span =\n shouldCreateSpanResult && hasParent\n ? startInactiveSpan({\n name: `${method} ${urlForSpanName}`,\n attributes: {\n url: stripDataUrlContent(url),\n type: 'xhr',\n 'http.method': method,\n 'http.url': fullUrl ? stripDataUrlContent(fullUrl) : undefined,\n 'server.address': parsedUrl?.host,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client',\n ...(parsedUrl?.search && { 'http.query': parsedUrl?.search }),\n ...(parsedUrl?.hash && { 'http.fragment': parsedUrl?.hash }),\n },\n })\n : new SentryNonRecordingSpan();\n\n if (shouldCreateSpanResult && !hasParent) {\n client?.recordDroppedEvent('no_parent_span', 'span');\n }\n\n xhr.__sentry_xhr_span_id__ = span.spanContext().spanId;\n spans[xhr.__sentry_xhr_span_id__] = span;\n\n if (shouldAttachHeaders(url)) {\n addTracingHeadersToXhrRequest(\n xhr,\n // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction),\n // we do not want to use the span as base for the trace headers,\n // which means that the headers will be generated from the scope and the sampling decision is deferred\n hasSpansEnabled() && hasParent ? span : undefined,\n propagateTraceparent,\n );\n }\n\n if (client) {\n client.emit('beforeOutgoingRequestSpan', span, handlerData as XhrHint);\n }\n\n return span;\n}\n\nfunction addTracingHeadersToXhrRequest(\n xhr: SentryWrappedXMLHttpRequest,\n span?: Span,\n propagateTraceparent?: boolean,\n): void {\n const { 'sentry-trace': sentryTrace, baggage, traceparent } = getTraceData({ span, propagateTraceparent });\n\n if (sentryTrace) {\n setHeaderOnXhr(xhr, sentryTrace, baggage, traceparent);\n }\n}\n\nfunction setHeaderOnXhr(\n xhr: SentryWrappedXMLHttpRequest,\n sentryTraceHeader: string,\n sentryBaggageHeader: string | undefined,\n traceparentHeader: string | undefined,\n): void {\n const originalHeaders = xhr.__sentry_xhr_v3__?.request_headers;\n\n if (originalHeaders?.['sentry-trace'] || !xhr.setRequestHeader) {\n // bail if a sentry-trace header is already set\n return;\n }\n\n try {\n xhr.setRequestHeader('sentry-trace', sentryTraceHeader);\n\n if (traceparentHeader && !originalHeaders?.['traceparent']) {\n xhr.setRequestHeader('traceparent', traceparentHeader);\n }\n\n if (sentryBaggageHeader) {\n // only add our headers if\n // - no pre-existing baggage header exists\n // - or it is set and doesn't yet contain sentry values\n const originalBaggageHeader = originalHeaders?.['baggage'];\n if (!originalBaggageHeader || !baggageHeaderHasSentryValues(originalBaggageHeader)) {\n // From MDN: \"If this method is called several times with the same header, the values are merged into one single request header.\"\n // We can therefore simply set a baggage header without checking what was there before\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader\n xhr.setRequestHeader('baggage', sentryBaggageHeader);\n }\n }\n } catch {\n // Error: InvalidStateError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': The object's state must be OPENED.\n }\n}\n"],"names":[],"mappings":";;;;AA2CA;;AAkFA,MAAM,gBAAA,GAAmB,IAAI,OAAO,EAAkB;AACtD,MAAM,oBAAA,GAAuB,IAAI,GAAG,EAAkB;;AAE/C,MAAM,oCAAoC,GAAkC;AACnF,EAAE,UAAU,EAAE,IAAI;AAClB,EAAE,QAAQ,EAAE,IAAI;AAChB,EAAE,iBAAiB,EAAE,IAAI;AACzB,EAAE,2BAA2B,EAAE,KAAK;AACpC;;AAEA;AACO,SAAS,0BAA0B,CAAC,MAAM,EAAU,QAAQ,EAAiD;AACpH,EAAE,MAAM;AACR,IAAI,UAAU;AACd,IAAI,QAAQ;AACZ,IAAI,2BAA2B;AAC/B,IAAI,0BAA0B;AAC9B,IAAI,iBAAiB;AACrB,IAAI,uBAAuB;AAC3B,IAAI,kBAAkB;AACtB,IAAI,gBAAgB;AACpB,MAAM;AACN,IAAI,GAAG,oCAAoC;AAC3C,IAAI,GAAG,QAAQ;AACf,GAAG;;AAEH,EAAE,MAAM,gBAAA;AACR,IAAI,OAAO,0BAAA,KAA+B,UAAA,GAAa,0BAAA,GAA6B,CAAC,CAAC,KAAa,IAAI;;AAEvG,EAAE,MAAM,8BAAA,GAAiC,CAAC,GAAG,KAAsB,mBAAmB,CAAC,GAAG,EAAE,uBAAuB,CAAC;;AAEpH,EAAE,MAAM,KAAK,GAAyB,EAAE;;AAExC,EAAE,MAAM,oBAAA,GAAuB,CAAC,MAAA,G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AAA,GAAA,CAAA,gBAAA,CAAA,cAAA,EAAA,iBAAA,CAAA;;AAEA,IAAA,IAAA,iBAAA,IAAA,CAAA,eAAA,GAAA,aAAA,CAAA,EAAA;AACA,MAAA,GAAA,CAAA,gBAAA,CAAA,aAAA,EAAA,iBAAA,CAAA;AACA,IAAA;;AAEA,IAAA,IAAA,mBAAA,EAAA;AACA;AACA;AACA;AACA,MAAA,MAAA,qBAAA,GAAA,eAAA,GAAA,SAAA,CAAA;AACA,MAAA,IAAA,CAAA,qBAAA,IAAA,CAAA,4BAAA,CAAA,qBAAA,CAAA,EAAA;AACA;AACA;AACA;AACA,QAAA,GAAA,CAAA,gBAAA,CAAA,SAAA,EAAA,mBAAA,CAAA;AACA,MAAA;AACA,IAAA;AACA,EAAA,CAAA,CAAA,MAAA;AACA;AACA,EAAA;AACA;;;;"}
1
+ {"version":3,"file":"request.js","sources":["../../../../../src/tracing/request.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport type {\n Client,\n HandlerDataXhr,\n RequestHookInfo,\n ResponseHookInfo,\n SentryWrappedXMLHttpRequest,\n Span,\n SpanTimeInput,\n} from '@sentry/core';\nimport {\n addFetchEndInstrumentationHandler,\n addFetchInstrumentationHandler,\n getActiveSpan,\n getClient,\n getLocationHref,\n getTraceData,\n hasSpansEnabled,\n hasSpanStreamingEnabled,\n instrumentFetchRequest,\n parseUrl,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SentryNonRecordingSpan,\n setHttpStatus,\n spanToJSON,\n startInactiveSpan,\n stringMatchesSomePattern,\n stripDataUrlContent,\n stripUrlQueryAndFragment,\n timestampInSeconds,\n} from '@sentry/core';\nimport type { XhrHint } from '@sentry-internal/browser-utils';\nimport {\n addPerformanceInstrumentationHandler,\n addXhrInstrumentationHandler,\n parseXhrResponseHeaders,\n resourceTimingToSpanAttributes,\n SENTRY_XHR_DATA_KEY,\n} from '@sentry-internal/browser-utils';\nimport type { BrowserClient } from '../client';\nimport { baggageHeaderHasSentryValues, createHeadersSafely, getFullURL, isPerformanceResourceTiming } from './utils';\n\n/** Options for Request Instrumentation */\nexport interface RequestInstrumentationOptions {\n /**\n * List of strings and/or Regular Expressions used to determine which outgoing requests will have `sentry-trace` and `baggage`\n * headers attached.\n *\n * **Default:** If this option is not provided, tracing headers will be attached to all outgoing requests.\n * If you are using a browser SDK, by default, tracing headers will only be attached to outgoing requests to the same origin.\n *\n * **Disclaimer:** Carelessly setting this option in browser environments may result into CORS errors!\n * Only attach tracing headers to requests to the same origin, or to requests to services you can control CORS headers of.\n * Cross-origin requests, meaning requests to a different domain, for example a request to `https://api.example.com/` while you're on `https://example.com/`, take special care.\n * If you are attaching headers to cross-origin requests, make sure the backend handling the request returns a `\"Access-Control-Allow-Headers: sentry-trace, baggage\"` header to ensure your requests aren't blocked.\n *\n * If you provide a `tracePropagationTargets` array, the entries you provide will be matched against the entire URL of the outgoing request.\n * If you are using a browser SDK, the entries will also be matched against the pathname of the outgoing requests.\n * This is so you can have matchers for relative requests, for example, `/^\\/api/` if you want to trace requests to your `/api` routes on the same domain.\n *\n * If any of the two match any of the provided values, tracing headers will be attached to the outgoing request.\n * Both, the string values, and the RegExes you provide in the array will match if they partially match the URL or pathname.\n *\n * Examples:\n * - `tracePropagationTargets: [/^\\/api/]` and request to `https://same-origin.com/api/posts`:\n * - Tracing headers will be attached because the request is sent to the same origin and the regex matches the pathname \"/api/posts\".\n * - `tracePropagationTargets: [/^\\/api/]` and request to `https://different-origin.com/api/posts`:\n * - Tracing headers will not be attached because the pathname will only be compared when the request target lives on the same origin.\n * - `tracePropagationTargets: [/^\\/api/, 'https://external-api.com']` and request to `https://external-api.com/v1/data`:\n * - Tracing headers will be attached because the request URL matches the string `'https://external-api.com'`.\n */\n tracePropagationTargets?: Array<string | RegExp>;\n\n /**\n * Flag to disable patching all together for fetch requests.\n *\n * Default: true\n */\n traceFetch: boolean;\n\n /**\n * Flag to disable patching all together for xhr requests.\n *\n * Default: true\n */\n traceXHR: boolean;\n\n /**\n * Flag to disable tracking of long-lived streams, like server-sent events (SSE) via fetch.\n * Do not enable this in case you have live streams or very long running streams.\n *\n * Disabled by default since it can lead to issues with streams using the `cancel()` api\n * (https://github.com/getsentry/sentry-javascript/issues/13950)\n *\n * Default: false\n */\n trackFetchStreamPerformance: boolean;\n\n /**\n * If true, Sentry will capture http timings and add them to the corresponding http spans.\n *\n * Default: true\n */\n enableHTTPTimings: boolean;\n\n /**\n * This function will be called before creating a span for a request with the given url.\n * Return false if you don't want a span for the given url.\n *\n * Default: (url: string) => true\n */\n shouldCreateSpanForRequest?(this: void, url: string): boolean;\n\n /**\n * Is called when spans are started for outgoing requests.\n */\n onRequestSpanStart?(span: Span, requestInformation: RequestHookInfo): void;\n\n /**\n * Is called when spans end for outgoing requests, providing access to response headers.\n */\n onRequestSpanEnd?(span: Span, responseInformation: ResponseHookInfo): void;\n}\n\nconst responseToSpanId = new WeakMap<object, string>();\nconst spanIdToEndTimestamp = new Map<string, number>();\n\nexport const defaultRequestInstrumentationOptions: RequestInstrumentationOptions = {\n traceFetch: true,\n traceXHR: true,\n enableHTTPTimings: true,\n trackFetchStreamPerformance: false,\n};\n\n/** Registers span creators for xhr and fetch requests */\nexport function instrumentOutgoingRequests(client: Client, _options?: Partial<RequestInstrumentationOptions>): void {\n const {\n traceFetch,\n traceXHR,\n trackFetchStreamPerformance,\n shouldCreateSpanForRequest,\n enableHTTPTimings,\n tracePropagationTargets,\n onRequestSpanStart,\n onRequestSpanEnd,\n } = {\n ...defaultRequestInstrumentationOptions,\n ..._options,\n };\n\n const shouldCreateSpan =\n typeof shouldCreateSpanForRequest === 'function' ? shouldCreateSpanForRequest : (_: string) => true;\n\n const shouldAttachHeadersWithTargets = (url: string): boolean => shouldAttachHeaders(url, tracePropagationTargets);\n\n const spans: Record<string, Span> = {};\n\n const propagateTraceparent = (client as BrowserClient).getOptions().propagateTraceparent;\n\n if (traceFetch) {\n // Keeping track of http requests, whose body payloads resolved later than the initial resolved request\n // e.g. streaming using server sent events (SSE)\n client.addEventProcessor(event => {\n if (event.type === 'transaction' && event.spans) {\n event.spans.forEach(span => {\n if (span.op === 'http.client') {\n const updatedTimestamp = spanIdToEndTimestamp.get(span.span_id);\n if (updatedTimestamp) {\n span.timestamp = updatedTimestamp / 1000;\n spanIdToEndTimestamp.delete(span.span_id);\n }\n }\n });\n }\n return event;\n });\n\n if (trackFetchStreamPerformance) {\n addFetchEndInstrumentationHandler(handlerData => {\n if (handlerData.response) {\n const span = responseToSpanId.get(handlerData.response);\n if (span && handlerData.endTimestamp) {\n spanIdToEndTimestamp.set(span, handlerData.endTimestamp);\n }\n }\n });\n }\n\n addFetchInstrumentationHandler(handlerData => {\n const createdSpan = instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans, {\n propagateTraceparent,\n onRequestSpanEnd,\n });\n\n if (handlerData.response && handlerData.fetchData.__span) {\n responseToSpanId.set(handlerData.response, handlerData.fetchData.__span);\n }\n\n // We cannot use `window.location` in the generic fetch instrumentation,\n // but we need it for reliable `server.address` attribute.\n // so we extend this in here\n if (createdSpan) {\n const fullUrl = getFullURL(handlerData.fetchData.url);\n const host = fullUrl ? parseUrl(fullUrl).host : undefined;\n createdSpan.setAttributes({\n 'http.url': fullUrl ? stripDataUrlContent(fullUrl) : undefined,\n 'server.address': host,\n });\n\n if (enableHTTPTimings) {\n addHTTPTimings(createdSpan, client);\n }\n\n onRequestSpanStart?.(createdSpan, { headers: handlerData.headers });\n }\n });\n }\n\n if (traceXHR) {\n addXhrInstrumentationHandler(handlerData => {\n const createdSpan = xhrCallback(\n handlerData,\n shouldCreateSpan,\n shouldAttachHeadersWithTargets,\n spans,\n propagateTraceparent,\n onRequestSpanEnd,\n );\n\n if (createdSpan) {\n if (enableHTTPTimings) {\n addHTTPTimings(createdSpan, client);\n }\n\n onRequestSpanStart?.(createdSpan, {\n headers: createHeadersSafely(handlerData.xhr.__sentry_xhr_v3__?.request_headers),\n });\n }\n });\n }\n}\n\n/**\n * The maximum time (ms) to wait for PerformanceResourceTiming data before ending the span.\n * Same approach is used by OTel's browser fetch instrumentation:\n * See {@link https://github.com/open-telemetry/opentelemetry-js/blob/30f94fe99339287b1e4d3c8bb90172c2523f06f4/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts#L352-L372}\n */\nconst HTTP_TIMING_WAIT_MS = 300;\n\n/**\n * Creates a temporary observer to listen to the next fetch/xhr resourcing timings,\n * so that when timings hit their per-browser limit they don't need to be removed.\n *\n * @param span A span that has yet to be finished, must contain `url` on data.\n */\nfunction addHTTPTimings(span: Span, client: Client): void {\n const { url } = spanToJSON(span).data;\n\n if (!url || typeof url !== 'string') {\n return;\n }\n\n // Clean up the performance observer and other resources\n // We have to wait here because otherwise this cleans itself up before it is fully done.\n // Default (non-streaming): just deregister the observer.\n let onEntryFound = (): void => void setTimeout(unsubscribePerformanceObsever);\n\n // For streamed spans, we have to artificially delay the ending of the span until we\n // either receive the timing data, or HTTP_TIMING_WAIT_MS elapses.\n if (hasSpanStreamingEnabled(client)) {\n const originalEnd = span.end.bind(span);\n\n span.end = (endTimestamp?: SpanTimeInput) => {\n const capturedEndTimestamp = endTimestamp ?? timestampInSeconds();\n let isEnded = false;\n\n const endSpanAndCleanup = (): void => {\n if (isEnded) {\n return;\n }\n isEnded = true;\n setTimeout(unsubscribePerformanceObsever);\n originalEnd(capturedEndTimestamp);\n clearTimeout(fallbackTimeout);\n };\n\n onEntryFound = endSpanAndCleanup;\n\n // Fallback: always end the span after HTTP_TIMING_WAIT_MS even if no\n // PerformanceResourceTiming entry arrives (e.g. cross-origin without\n // Timing-Allow-Origin, or the browser didn't fire the observer in time).\n const fallbackTimeout = setTimeout(endSpanAndCleanup, HTTP_TIMING_WAIT_MS);\n };\n }\n\n const unsubscribePerformanceObsever = addPerformanceInstrumentationHandler('resource', ({ entries }) => {\n entries.forEach(entry => {\n if (isPerformanceResourceTiming(entry) && entry.name.endsWith(url)) {\n span.setAttributes(resourceTimingToSpanAttributes(entry));\n onEntryFound();\n }\n });\n });\n}\n\n/**\n * A function that determines whether to attach tracing headers to a request.\n * We only export this function for testing purposes.\n */\nexport function shouldAttachHeaders(\n targetUrl: string,\n tracePropagationTargets: (string | RegExp)[] | undefined,\n): boolean {\n // window.location.href not being defined is an edge case in the browser but we need to handle it.\n // Potentially dangerous situations where it may not be defined: Browser Extensions, Web Workers, patching of the location obj\n const href = getLocationHref();\n\n if (!href) {\n // If there is no window.location.origin, we default to only attaching tracing headers to relative requests, i.e. ones that start with `/`\n // BIG DISCLAIMER: Users can call URLs with a double slash (fetch(\"//example.com/api\")), this is a shorthand for \"send to the same protocol\",\n // so we need a to exclude those requests, because they might be cross origin.\n const isRelativeSameOriginRequest = !!targetUrl.match(/^\\/(?!\\/)/);\n if (!tracePropagationTargets) {\n return isRelativeSameOriginRequest;\n } else {\n return stringMatchesSomePattern(targetUrl, tracePropagationTargets);\n }\n } else {\n let resolvedUrl;\n let currentOrigin;\n\n // URL parsing may fail, we default to not attaching trace headers in that case.\n try {\n resolvedUrl = new URL(targetUrl, href);\n currentOrigin = new URL(href).origin;\n } catch {\n return false;\n }\n\n const isSameOriginRequest = resolvedUrl.origin === currentOrigin;\n if (!tracePropagationTargets) {\n return isSameOriginRequest;\n } else {\n return (\n stringMatchesSomePattern(resolvedUrl.toString(), tracePropagationTargets) ||\n (isSameOriginRequest && stringMatchesSomePattern(resolvedUrl.pathname, tracePropagationTargets))\n );\n }\n }\n}\n\n/**\n * Create and track xhr request spans\n *\n * @returns Span if a span was created, otherwise void.\n */\nfunction xhrCallback(\n handlerData: HandlerDataXhr,\n shouldCreateSpan: (url: string) => boolean,\n shouldAttachHeaders: (url: string) => boolean,\n spans: Record<string, Span>,\n propagateTraceparent?: boolean,\n onRequestSpanEnd?: RequestInstrumentationOptions['onRequestSpanEnd'],\n): Span | undefined {\n const xhr = handlerData.xhr;\n const sentryXhrData = xhr?.[SENTRY_XHR_DATA_KEY];\n\n if (!xhr || xhr.__sentry_own_request__ || !sentryXhrData) {\n return undefined;\n }\n\n const { url, method } = sentryXhrData;\n\n const shouldCreateSpanResult = hasSpansEnabled() && shouldCreateSpan(url);\n\n // Handle XHR completion - clean up spans from the record\n if (handlerData.endTimestamp) {\n const spanId = xhr.__sentry_xhr_span_id__;\n if (!spanId) return;\n\n const span = spans[spanId];\n\n if (span) {\n if (shouldCreateSpanResult && sentryXhrData.status_code !== undefined) {\n setHttpStatus(span, sentryXhrData.status_code);\n span.end();\n\n onRequestSpanEnd?.(span, {\n headers: createHeadersSafely(parseXhrResponseHeaders(xhr as XMLHttpRequest & SentryWrappedXMLHttpRequest)),\n error: handlerData.error,\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete spans[spanId];\n }\n\n return undefined;\n }\n\n const fullUrl = getFullURL(url);\n const parsedUrl = fullUrl ? parseUrl(fullUrl) : parseUrl(url);\n\n const urlForSpanName = stripDataUrlContent(stripUrlQueryAndFragment(url));\n\n const client = getClient();\n const hasParent = !!getActiveSpan();\n // With span streaming, we always emit http.client spans, even without a parent span\n const shouldEmitSpan = hasParent || (!!client && hasSpanStreamingEnabled(client));\n\n const span =\n shouldCreateSpanResult && shouldEmitSpan\n ? startInactiveSpan({\n name: `${method} ${urlForSpanName}`,\n attributes: {\n url: stripDataUrlContent(url),\n type: 'xhr',\n 'http.method': method,\n 'http.url': fullUrl ? stripDataUrlContent(fullUrl) : undefined,\n 'server.address': parsedUrl?.host,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser',\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client',\n ...(parsedUrl?.search && { 'http.query': parsedUrl?.search }),\n ...(parsedUrl?.hash && { 'http.fragment': parsedUrl?.hash }),\n },\n })\n : new SentryNonRecordingSpan();\n\n if (shouldCreateSpanResult && !shouldEmitSpan) {\n client?.recordDroppedEvent('no_parent_span', 'span');\n }\n\n xhr.__sentry_xhr_span_id__ = span.spanContext().spanId;\n spans[xhr.__sentry_xhr_span_id__] = span;\n\n if (shouldAttachHeaders(url)) {\n addTracingHeadersToXhrRequest(\n xhr,\n // If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction),\n // we do not want to use the span as base for the trace headers,\n // which means that the headers will be generated from the scope and the sampling decision is deferred\n hasSpansEnabled() && shouldEmitSpan ? span : undefined,\n propagateTraceparent,\n );\n }\n\n if (client) {\n client.emit('beforeOutgoingRequestSpan', span, handlerData as XhrHint);\n }\n\n return span;\n}\n\nfunction addTracingHeadersToXhrRequest(\n xhr: SentryWrappedXMLHttpRequest,\n span?: Span,\n propagateTraceparent?: boolean,\n): void {\n const { 'sentry-trace': sentryTrace, baggage, traceparent } = getTraceData({ span, propagateTraceparent });\n\n if (sentryTrace) {\n setHeaderOnXhr(xhr, sentryTrace, baggage, traceparent);\n }\n}\n\nfunction setHeaderOnXhr(\n xhr: SentryWrappedXMLHttpRequest,\n sentryTraceHeader: string,\n sentryBaggageHeader: string | undefined,\n traceparentHeader: string | undefined,\n): void {\n const originalHeaders = xhr.__sentry_xhr_v3__?.request_headers;\n\n if (originalHeaders?.['sentry-trace'] || !xhr.setRequestHeader) {\n // bail if a sentry-trace header is already set\n return;\n }\n\n try {\n xhr.setRequestHeader('sentry-trace', sentryTraceHeader);\n\n if (traceparentHeader && !originalHeaders?.['traceparent']) {\n xhr.setRequestHeader('traceparent', traceparentHeader);\n }\n\n if (sentryBaggageHeader) {\n // only add our headers if\n // - no pre-existing baggage header exists\n // - or it is set and doesn't yet contain sentry values\n const originalBaggageHeader = originalHeaders?.['baggage'];\n if (!originalBaggageHeader || !baggageHeaderHasSentryValues(originalBaggageHeader)) {\n // From MDN: \"If this method is called several times with the same header, the values are merged into one single request header.\"\n // We can therefore simply set a baggage header without checking what was there before\n // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader\n xhr.setRequestHeader('baggage', sentryBaggageHeader);\n }\n }\n } catch {\n // Error: Inv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AA,CAAA;AACA,IAAA;;AAEA,IAAA,IAAA,mBAAA,EAAA;AACA;AACA;AACA;AACA,MAAA,MAAA,qBAAA,GAAA,eAAA,GAAA,SAAA,CAAA;AACA,MAAA,IAAA,CAAA,qBAAA,IAAA,CAAA,4BAAA,CAAA,qBAAA,CAAA,EAAA;AACA;AACA;AACA;AACA,QAAA,GAAA,CAAA,gBAAA,CAAA,SAAA,EAAA,mBAAA,CAAA;AACA,MAAA;AACA,IAAA;AACA,EAAA,CAAA,CAAA,MAAA;AACA;AACA,EAAA;AACA;;;;"}
@@ -19,7 +19,7 @@ export { reportPageLoaded } from './tracing/reportPageLoaded';
19
19
  export { setActiveSpanInBrowser } from './tracing/setActiveSpan';
20
20
  export { spanStreamingIntegration } from './integrations/spanstreaming';
21
21
  export type { RequestInstrumentationOptions } from './tracing/request';
22
- export { registerSpanErrorInstrumentation, getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, withActiveSpan, startNewTrace, getSpanDescendants, setMeasurement, getSpanStatusFromHttpCode, setHttpStatus, makeMultiplexedTransport, MULTIPLEXED_TRANSPORT_EXTRA_KEY, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, thirdPartyErrorFilterIntegration, featureFlagsIntegration, instrumentAnthropicAiClient, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentLangGraph, createLangChainCallbackHandler, instrumentLangChainEmbeddings, logger, } from '@sentry/core';
22
+ export { registerSpanErrorInstrumentation, getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, withActiveSpan, startNewTrace, getSpanDescendants, setMeasurement, getSpanStatusFromHttpCode, setHttpStatus, makeMultiplexedTransport, MULTIPLEXED_TRANSPORT_EXTRA_KEY, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, thirdPartyErrorFilterIntegration, featureFlagsIntegration, instrumentAnthropicAiClient, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentLangGraph, instrumentCreateReactAgent, createLangChainCallbackHandler, instrumentLangChainEmbeddings, logger, } from '@sentry/core';
23
23
  export type { Span, FeatureFlagsIntegration } from '@sentry/core';
24
24
  export { makeBrowserOfflineTransport } from './transports/offline';
25
25
  export { browserProfilingIntegration } from './profiling/integration';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACvE,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,uBAAuB,IAAI,mBAAmB,EAAE,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,oCAAoC,EAAE,0BAA0B,EAAE,M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AAE,MAAM,yCAAyC,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"culturecontext.d.ts","sourceRoot":"","sources":["../../../../src/integrations/culturecontext.ts"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,0CAAgD,CAAC"}
1
+ {"version":3,"file":"culturecontext.d.ts","sourceRoot":"","sources":["../../../../src/integrations/culturecontext.ts"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,0CAAgD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"httpcontext.d.ts","sourceRoot":"","sources":["../../../../src/integrations/httpcontext.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,sBAAsB,0CAsBjC,CAAC"}
1
+ {"version":3,"file":"httpcontext.d.ts","sourceRoot":"","sources":["../../../../src/integrations/httpcontext.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,sBAAsB,0CAsCjC,CAAC"}
@@ -1,4 +1,3 @@
1
- import type { Event } from '@sentry/core';
2
1
  export type SpotlightConnectionOptions = {
3
2
  /**
4
3
  * Set this if the Spotlight Sidecar is not running on localhost:8969
@@ -7,14 +6,14 @@ export type SpotlightConnectionOptions = {
7
6
  sidecarUrl?: string;
8
7
  };
9
8
  export declare const INTEGRATION_NAME = "SpotlightBrowser";
9
+ export declare const SPOTLIGHT_IGNORE_SPANS: {
10
+ op: string;
11
+ name: string;
12
+ }[];
10
13
  /**
11
14
  * Use this integration to send errors and transactions to Spotlight.
12
15
  *
13
16
  * Learn more about spotlight at https://spotlightjs.com
14
17
  */
15
18
  export declare const spotlightBrowserIntegration: (options?: Partial<SpotlightConnectionOptions> | undefined) => import("@sentry/core").Integration;
16
- /**
17
- * Flags if the event is a transaction created from an interaction with the spotlight UI.
18
- */
19
- export declare function isSpotlightInteraction(event: Event): boolean;
20
19
  //# sourceMappingURL=spotlight.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../../../src/integrations/spotlight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,KAAK,EAAiB,MAAM,cAAc,CAAC;AAM3E,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAuDnD;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,mGAA2C,CAAC;AAEpF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAQ5D"}
1
+ {"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../../../../src/integrations/spotlight.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,eAAO,MAAM,sBAAsB;;;GAA8D,CAAC;AAuDlG;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,mGAA2C,CAAC"}
@@ -19,7 +19,7 @@ export { reportPageLoaded } from './tracing/reportPageLoaded';
19
19
  export { setActiveSpanInBrowser } from './tracing/setActiveSpan';
20
20
  export { spanStreamingIntegration } from './integrations/spanstreaming';
21
21
  export { RequestInstrumentationOptions } from './tracing/request';
22
- export { registerSpanErrorInstrumentation, getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, withActiveSpan, startNewTrace, getSpanDescendants, setMeasurement, getSpanStatusFromHttpCode, setHttpStatus, makeMultiplexedTransport, MULTIPLEXED_TRANSPORT_EXTRA_KEY, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, thirdPartyErrorFilterIntegration, featureFlagsIntegration, instrumentAnthropicAiClient, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentLangGraph, createLangChainCallbackHandler, instrumentLangChainEmbeddings, logger, } from '@sentry/core';
22
+ export { registerSpanErrorInstrumentation, getActiveSpan, getRootSpan, startSpan, startInactiveSpan, startSpanManual, withActiveSpan, startNewTrace, getSpanDescendants, setMeasurement, getSpanStatusFromHttpCode, setHttpStatus, makeMultiplexedTransport, MULTIPLEXED_TRANSPORT_EXTRA_KEY, moduleMetadataIntegration, supabaseIntegration, instrumentSupabaseClient, zodErrorsIntegration, thirdPartyErrorFilterIntegration, featureFlagsIntegration, instrumentAnthropicAiClient, instrumentOpenAiClient, instrumentGoogleGenAIClient, instrumentLangGraph, instrumentCreateReactAgent, createLangChainCallbackHandler, instrumentLangChainEmbeddings, logger, } from '@sentry/core';
23
23
  export { Span, FeatureFlagsIntegration } from '@sentry/core';
24
24
  export { makeBrowserOfflineTransport } from './transports/offline';
25
25
  export { browserProfilingIntegration } from './profiling/integration';
@@ -1,4 +1,3 @@
1
- import { Event } from '@sentry/core';
2
1
  export type SpotlightConnectionOptions = {
3
2
  /**
4
3
  * Set this if the Spotlight Sidecar is not running on localhost:8969
@@ -7,14 +6,14 @@ export type SpotlightConnectionOptions = {
7
6
  sidecarUrl?: string;
8
7
  };
9
8
  export declare const INTEGRATION_NAME = "SpotlightBrowser";
9
+ export declare const SPOTLIGHT_IGNORE_SPANS: {
10
+ op: string;
11
+ name: string;
12
+ }[];
10
13
  /**
11
14
  * Use this integration to send errors and transactions to Spotlight.
12
15
  *
13
16
  * Learn more about spotlight at https://spotlightjs.com
14
17
  */
15
18
  export declare const spotlightBrowserIntegration: (options?: Partial<SpotlightConnectionOptions> | undefined) => import("@sentry/core").Integration;
16
- /**
17
- * Flags if the event is a transaction created from an interaction with the spotlight UI.
18
- */
19
- export declare function isSpotlightInteraction(event: Event): boolean;
20
19
  //# sourceMappingURL=spotlight.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/browser",
3
- "version": "10.50.0",
3
+ "version": "10.52.0",
4
4
  "description": "Official Sentry SDK for browsers",
5
5
  "repository": "git://github.com/getsentry/sentry-javascript.git",
6
6
  "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
@@ -44,14 +44,14 @@
44
44
  "access": "public"
45
45
  },
46
46
  "dependencies": {
47
- "@sentry-internal/browser-utils": "10.50.0",
48
- "@sentry-internal/feedback": "10.50.0",
49
- "@sentry-internal/replay": "10.50.0",
50
- "@sentry-internal/replay-canvas": "10.50.0",
51
- "@sentry/core": "10.50.0"
47
+ "@sentry-internal/browser-utils": "10.52.0",
48
+ "@sentry-internal/feedback": "10.52.0",
49
+ "@sentry-internal/replay": "10.52.0",
50
+ "@sentry-internal/replay-canvas": "10.52.0",
51
+ "@sentry/core": "10.52.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@sentry-internal/integration-shims": "10.50.0",
54
+ "@sentry-internal/integration-shims": "10.52.0",
55
55
  "fake-indexeddb": "^6.2.4"
56
56
  },
57
57
  "scripts": {