( url: string, parsedUrl: ReturnType<typeof parseStringToURLObject>, method: string, spanOrigin: SpanOrigin, )
| 373 | } |
| 374 | |
| 375 | function 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 | } |
no test coverage detected