File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ export default function (): void {
4343
4444 let jsParseStartMs : number | undefined ;
4545 const observer = new PerformanceObserver ( ( list ) => {
46- for ( const entry of list . getEntries ( ) ) {
46+ const entries = list . getEntries ( ) ;
47+ for ( const entry of entries ) {
4748 if ( entry . name === 'runJsBundleStart' && jsParseStartMs === undefined ) {
4849 jsParseStartMs = entry . startTime ;
4950 startSpan ( CONST . TELEMETRY . SPAN_JS_PARSE_TIME , {
@@ -52,8 +53,11 @@ export default function (): void {
5253 startTime : jsParseStartMs / 1000 ,
5354 } ) ;
5455 }
55- if ( entry . name === 'runJsBundleEnd' && jsParseStartMs !== undefined ) {
56- endSpan ( CONST . TELEMETRY . SPAN_JS_PARSE_TIME , entry . startTime / 1000 ) ;
56+ if ( entry . name === 'runJsBundleEnd' ) {
57+ const durationMs = jsParseStartMs !== undefined ? Math . round ( entry . startTime - jsParseStartMs ) : 'n/a' ;
58+ if ( jsParseStartMs !== undefined && durationMs !== 'n/a' ) {
59+ endSpan ( CONST . TELEMETRY . SPAN_JS_PARSE_TIME , durationMs ) ;
60+ }
5761 observer . disconnect ( ) ;
5862 }
5963 }
You can’t perform that action at this time.
0 commit comments