MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / getSpanStartOptions

Function getSpanStartOptions

packages/core/src/fetch.ts:350–373  ·  view source on GitHub ↗
(
  url: string,
  method: string,
  spanOrigin: SpanOrigin,
)

Source from the content-addressed store, hash-verified

348}
349
350function getSpanStartOptions(
351 url: string,
352 method: string,
353 spanOrigin: SpanOrigin,
354): Parameters<typeof startInactiveSpan>[0] {
355 // Data URLs need special handling because parseStringToURLObject treats them as "relative"
356 // (no "://"), causing getSanitizedUrlStringFromUrlObject to return just the pathname
357 // without the "data:" prefix, making later stripDataUrlContent calls ineffective.
358 // So for data URLs, we strip the content first and use that directly.
359 if (url.startsWith('data:')) {
360 const sanitizedUrl = stripDataUrlContent(url);
361 return {
362 name: `${method} ${sanitizedUrl}`,
363 attributes: getFetchSpanAttributes(url, undefined, method, spanOrigin),
364 };
365 }
366
367 const parsedUrl = parseStringToURLObject(url);
368 const sanitizedUrl = parsedUrl ? getSanitizedUrlStringFromUrlObject(parsedUrl) : url;
369 return {
370 name: `${method} ${sanitizedUrl}`,
371 attributes: getFetchSpanAttributes(url, parsedUrl, method, spanOrigin),
372 };
373}
374
375function getFetchSpanAttributes(
376 url: string,

Callers 1

instrumentFetchRequestFunction · 0.85

Calls 4

stripDataUrlContentFunction · 0.90
parseStringToURLObjectFunction · 0.90
getFetchSpanAttributesFunction · 0.85

Tested by

no test coverage detected