File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
packages/browser-utils/src/metrics Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -425,7 +425,7 @@ export function _addMeasureSpans(
425425 startTime : number ,
426426 duration : number ,
427427 timeOrigin : number ,
428- ) : number {
428+ ) : void {
429429 const navEntry = getNavigationEntry ( false ) ;
430430 const requestTime = msToSec ( navEntry ? navEntry . requestStart : 0 ) ;
431431 // Because performance.measure accepts arbitrary timestamps it can produce
@@ -450,13 +450,14 @@ export function _addMeasureSpans(
450450 attributes [ 'sentry.browser.measure_start_time' ] = measureStartTimestamp ;
451451 }
452452
453- startAndEndSpan ( span , measureStartTimestamp , measureEndTimestamp , {
454- name : entry . name as string ,
455- op : entry . entryType as string ,
456- attributes,
457- } ) ;
458-
459- return measureStartTimestamp ;
453+ // Measurements from third parties can be off, which would create invalid spans, dropping transactions in the process.
454+ if ( measureStartTimestamp <= measureEndTimestamp ) {
455+ startAndEndSpan ( span , measureStartTimestamp , measureEndTimestamp , {
456+ name : entry . name as string ,
457+ op : entry . entryType as string ,
458+ attributes,
459+ } ) ;
460+ }
460461}
461462
462463/** Instrument navigation entries */
You can’t perform that action at this time.
0 commit comments