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

Function getFetchSpanAttributes

packages/core/src/fetch.ts:375–401  ·  view source on GitHub ↗
(
  url: string,
  parsedUrl: ReturnType<typeof parseStringToURLObject>,
  method: string,
  spanOrigin: SpanOrigin,
)

Source from the content-addressed store, hash-verified

373}
374
375function getFetchSpanAttributes(
376 url: string,
377 parsedUrl: ReturnType<typeof parseStringToURLObject>,
378 method: string,
379 spanOrigin: SpanOrigin,
380): SpanAttributes {
381 const attributes: SpanAttributes = {
382 url: stripDataUrlContent(url),
383 type: 'fetch',
384 'http.method': method,
385 [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin,
386 [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client',
387 };
388 if (parsedUrl) {
389 if (!isURLObjectRelative(parsedUrl)) {
390 attributes['http.url'] = stripDataUrlContent(parsedUrl.href);
391 attributes['server.address'] = parsedUrl.host;
392 }
393 if (parsedUrl.search) {
394 attributes['http.query'] = parsedUrl.search;
395 }
396 if (parsedUrl.hash) {
397 attributes['http.fragment'] = parsedUrl.hash;
398 }
399 }
400 return attributes;
401}

Callers 1

getSpanStartOptionsFunction · 0.85

Calls 2

stripDataUrlContentFunction · 0.90
isURLObjectRelativeFunction · 0.90

Tested by

no test coverage detected