@@ -3,7 +3,7 @@ import type { IdleTransaction, Transaction } from '@sentry/core';
3
3
import { spanToJSON } from '@sentry/core' ;
4
4
import { getActiveTransaction , setMeasurement } from '@sentry/core' ;
5
5
import type { Measurements , SpanContext } from '@sentry/types' ;
6
- import { browserPerformanceTimeOrigin , getComponentName , htmlTreeAsString , logger } from '@sentry/utils' ;
6
+ import { browserPerformanceTimeOrigin , getComponentName , htmlTreeAsString , logger , parseUrl } from '@sentry/utils' ;
7
7
8
8
import { DEBUG_BUILD } from '../../common/debug-build' ;
9
9
import {
@@ -226,8 +226,8 @@ export function addPerformanceEntries(transaction: Transaction): void {
226
226
}
227
227
case 'resource' : {
228
228
const resourceName = ( entry . name as string ) . replace ( WINDOW . location . origin , '' ) ;
229
- const resourceOrigin = new URL ( entry . name as string ) . origin ;
230
- _addResourceSpans ( transaction , entry , resourceName , resourceOrigin , startTime , duration , timeOrigin ) ;
229
+ const resourceUrl = parseUrl ( entry . name as string ) ;
230
+ _addResourceSpans ( transaction , entry , resourceName , resourceUrl , startTime , duration , timeOrigin ) ;
231
231
break ;
232
232
}
233
233
default :
@@ -403,7 +403,7 @@ export function _addResourceSpans(
403
403
transaction : Transaction ,
404
404
entry : ResourceEntry ,
405
405
resourceName : string ,
406
- resourceOrigin : string ,
406
+ resourceUrl : ReturnType < typeof parseUrl > ,
407
407
startTime : number ,
408
408
duration : number ,
409
409
timeOrigin : number ,
@@ -422,10 +422,16 @@ export function _addResourceSpans(
422
422
if ( 'renderBlockingStatus' in entry ) {
423
423
data [ 'resource.render_blocking_status' ] = entry . renderBlockingStatus ;
424
424
}
425
- if ( resourceOrigin ) {
426
- data [ 'span.domain ' ] = resourceOrigin ;
425
+ if ( resourceUrl . protocol ) {
426
+ data [ 'url.scheme ' ] = resourceUrl . protocol ;
427
427
}
428
428
429
+ if ( resourceUrl . host ) {
430
+ data [ 'server.address' ] = resourceUrl . host ;
431
+ }
432
+
433
+ data [ 'url.same_origin' ] = resourceUrl . host === window . location . host ;
434
+
429
435
const startTimestamp = timeOrigin + startTime ;
430
436
const endTimestamp = startTimestamp + duration ;
431
437
0 commit comments