@@ -44,23 +44,7 @@ export class MetricsInstrumentation {
44
44
logger . log ( '[Tracing] Adding & adjusting spans using Performance API' ) ;
45
45
46
46
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
- }
61
47
62
- let entryScriptStartTimestamp : number | undefined ;
63
- let tracingInitMarkStartTime : number | undefined ;
64
48
let responseStartTimestamp : number | undefined ;
65
49
let requestStartTimestamp : number | undefined ;
66
50
@@ -86,10 +70,6 @@ export class MetricsInstrumentation {
86
70
case 'paint' :
87
71
case 'measure' : {
88
72
const startTimestamp = addMeasureSpans ( transaction , entry , startTime , duration , timeOrigin ) ;
89
- if ( tracingInitMarkStartTime === undefined && entry . name === 'sentry-tracing-init' ) {
90
- tracingInitMarkStartTime = startTimestamp ;
91
- }
92
-
93
73
// capture web vitals
94
74
95
75
const firstHidden = getVisibilityWatcher ( ) ;
@@ -112,27 +92,14 @@ export class MetricsInstrumentation {
112
92
}
113
93
case 'resource' : {
114
94
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 ) ;
120
96
break ;
121
97
}
122
98
default :
123
99
// Ignore other entry types.
124
100
}
125
101
} ) ;
126
102
127
- if ( entryScriptStartTimestamp !== undefined && tracingInitMarkStartTime !== undefined ) {
128
- _startChild ( transaction , {
129
- description : 'evaluation' ,
130
- endTimestamp : tracingInitMarkStartTime ,
131
- op : 'script' ,
132
- startTimestamp : entryScriptStartTimestamp ,
133
- } ) ;
134
- }
135
-
136
103
this . _performanceCursor = Math . max ( performance . getEntries ( ) . length - 1 , 0 ) ;
137
104
138
105
this . _trackNavigator ( transaction ) ;
@@ -335,11 +302,11 @@ export function addResourceSpans(
335
302
startTime : number ,
336
303
duration : number ,
337
304
timeOrigin : number ,
338
- ) : number | undefined {
305
+ ) : void {
339
306
// we already instrument based on fetch and xhr, so we don't need to
340
307
// duplicate spans here.
341
308
if ( entry . initiatorType === 'xmlhttprequest' || entry . initiatorType === 'fetch' ) {
342
- return undefined ;
309
+ return ;
343
310
}
344
311
345
312
const data : Record < string , any > = { } ;
@@ -363,8 +330,6 @@ export function addResourceSpans(
363
330
startTimestamp,
364
331
data,
365
332
} ) ;
366
-
367
- return endTimestamp ;
368
333
}
369
334
370
335
/** Create performance navigation related spans */
0 commit comments