@@ -225,9 +225,7 @@ export function addPerformanceEntries(transaction: Transaction): void {
225
225
break ;
226
226
}
227
227
case 'resource' : {
228
- const resourceName = ( entry . name as string ) . replace ( WINDOW . location . origin , '' ) ;
229
- const resourceUrl = parseUrl ( entry . name as string ) ;
230
- _addResourceSpans ( transaction , entry , resourceName , resourceUrl , startTime , duration , timeOrigin ) ;
228
+ _addResourceSpans ( transaction , entry , entry . name as string , startTime , duration , timeOrigin ) ;
231
229
break ;
232
230
}
233
231
default :
@@ -402,8 +400,7 @@ export interface ResourceEntry extends Record<string, unknown> {
402
400
export function _addResourceSpans (
403
401
transaction : Transaction ,
404
402
entry : ResourceEntry ,
405
- resourceName : string ,
406
- resourceUrl : ReturnType < typeof parseUrl > ,
403
+ resourceUrl : string ,
407
404
startTime : number ,
408
405
duration : number ,
409
406
timeOrigin : number ,
@@ -414,29 +411,32 @@ export function _addResourceSpans(
414
411
return ;
415
412
}
416
413
414
+ const parsedUrl = parseUrl ( resourceUrl ) ;
415
+
417
416
// eslint-disable-next-line @typescript-eslint/no-explicit-any
418
417
const data : Record < string , any > = { } ;
419
418
setResourceEntrySizeData ( data , entry , 'transferSize' , 'http.response_transfer_size' ) ;
420
419
setResourceEntrySizeData ( data , entry , 'encodedBodySize' , 'http.response_content_length' ) ;
421
420
setResourceEntrySizeData ( data , entry , 'decodedBodySize' , 'http.decoded_response_content_length' ) ;
421
+
422
422
if ( 'renderBlockingStatus' in entry ) {
423
423
data [ 'resource.render_blocking_status' ] = entry . renderBlockingStatus ;
424
424
}
425
- if ( resourceUrl . protocol ) {
426
- data [ 'url.scheme' ] = resourceUrl . protocol ;
425
+ if ( parsedUrl . protocol ) {
426
+ data [ 'url.scheme' ] = parsedUrl . protocol ;
427
427
}
428
428
429
- if ( resourceUrl . host ) {
430
- data [ 'server.address' ] = resourceUrl . host ;
429
+ if ( parsedUrl . host ) {
430
+ data [ 'server.address' ] = parsedUrl . host ;
431
431
}
432
432
433
- data [ 'url.same_origin' ] = resourceUrl . host === WINDOW . location . host ;
433
+ data [ 'url.same_origin' ] = resourceUrl . includes ( WINDOW . location . origin ) ;
434
434
435
435
const startTimestamp = timeOrigin + startTime ;
436
436
const endTimestamp = startTimestamp + duration ;
437
437
438
438
_startChild ( transaction , {
439
- description : resourceName ,
439
+ description : resourceUrl . replace ( WINDOW . location . origin , '' ) ,
440
440
endTimestamp,
441
441
op : entry . initiatorType ? `resource.${ entry . initiatorType } ` : 'resource.other' ,
442
442
origin : 'auto.resource.browser.metrics' ,
0 commit comments