@@ -44,23 +44,7 @@ export class MetricsInstrumentation {
4444 logger . log ( '[Tracing] Adding & adjusting spans using Performance API' ) ;
4545
4646 const timeOrigin = msToSec ( browserPerformanceTimeOrigin ) ;
47- let entryScriptSrc = '' ;
48-
49- if ( global . document && global . document . scripts ) {
50- // eslint-disable-next-line @typescript-eslint/prefer-for-of
51- for ( let i = 0 ; i < global . document . scripts . length ; i ++ ) {
52- // We go through all scripts on the page and look for 'data-entry'
53- // We remember the name and measure the time between this script finished loading and
54- // our mark 'sentry-tracing-init'
55- if ( global . document . scripts [ i ] . dataset . entry === 'true' ) {
56- entryScriptSrc = global . document . scripts [ i ] . src ;
57- break ;
58- }
59- }
60- }
6147
62- let entryScriptStartTimestamp : number | undefined ;
63- let tracingInitMarkStartTime : number | undefined ;
6448 let responseStartTimestamp : number | undefined ;
6549 let requestStartTimestamp : number | undefined ;
6650
@@ -86,10 +70,6 @@ export class MetricsInstrumentation {
8670 case 'paint' :
8771 case 'measure' : {
8872 const startTimestamp = addMeasureSpans ( transaction , entry , startTime , duration , timeOrigin ) ;
89- if ( tracingInitMarkStartTime === undefined && entry . name === 'sentry-tracing-init' ) {
90- tracingInitMarkStartTime = startTimestamp ;
91- }
92-
9373 // capture web vitals
9474
9575 const firstHidden = getVisibilityWatcher ( ) ;
@@ -112,27 +92,14 @@ export class MetricsInstrumentation {
11292 }
11393 case 'resource' : {
11494 const resourceName = ( entry . name as string ) . replace ( global . location . origin , '' ) ;
115- const endTimestamp = addResourceSpans ( transaction , entry , resourceName , startTime , duration , timeOrigin ) ;
116- // We remember the entry script end time to calculate the difference to the first init mark
117- if ( entryScriptStartTimestamp === undefined && entryScriptSrc . indexOf ( resourceName ) > - 1 ) {
118- entryScriptStartTimestamp = endTimestamp ;
119- }
95+ addResourceSpans ( transaction , entry , resourceName , startTime , duration , timeOrigin ) ;
12096 break ;
12197 }
12298 default :
12399 // Ignore other entry types.
124100 }
125101 } ) ;
126102
127- if ( entryScriptStartTimestamp !== undefined && tracingInitMarkStartTime !== undefined ) {
128- _startChild ( transaction , {
129- description : 'evaluation' ,
130- endTimestamp : tracingInitMarkStartTime ,
131- op : 'script' ,
132- startTimestamp : entryScriptStartTimestamp ,
133- } ) ;
134- }
135-
136103 this . _performanceCursor = Math . max ( performance . getEntries ( ) . length - 1 , 0 ) ;
137104
138105 this . _trackNavigator ( transaction ) ;
@@ -335,11 +302,11 @@ export function addResourceSpans(
335302 startTime : number ,
336303 duration : number ,
337304 timeOrigin : number ,
338- ) : number | undefined {
305+ ) : void {
339306 // we already instrument based on fetch and xhr, so we don't need to
340307 // duplicate spans here.
341308 if ( entry . initiatorType === 'xmlhttprequest' || entry . initiatorType === 'fetch' ) {
342- return undefined ;
309+ return ;
343310 }
344311
345312 const data : Record < string , any > = { } ;
@@ -363,8 +330,6 @@ export function addResourceSpans(
363330 startTimestamp,
364331 data,
365332 } ) ;
366-
367- return endTimestamp ;
368333}
369334
370335/** Create performance navigation related spans */
0 commit comments