diff --git a/packages/browser-utils/src/metrics/browserMetrics.ts b/packages/browser-utils/src/metrics/browserMetrics.ts index ae0dce615511..91cd94a9c754 100644 --- a/packages/browser-utils/src/metrics/browserMetrics.ts +++ b/packages/browser-utils/src/metrics/browserMetrics.ts @@ -124,32 +124,31 @@ export function startTrackingLongTasks(): void { * Start tracking long animation frames. */ export function startTrackingLongAnimationFrames(): void { - addPerformanceInstrumentationHandler('long-animation-frame', ({ entries }) => { - for (const entry of entries) { - if (!getActiveSpan()) { - return; - } - const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime); - const duration = msToSec(entry.duration); - - - const span = startInactiveSpan({ - name: 'Main UI thread blocked', - op: 'ui.long-animation-frame', - startTime, - attributes: { - [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', - }, - }); - if (span) { - span.end(startTime + duration); - } - } - }); + // NOTE: the current web-vitals version (3.5.2) does not support long-animation-frame, so + // we should directly observe `long-animation-frame` events here instead of through the web-vitals + // `observe` helper function. + // addPerformanceInstrumentationHandler('long-animation-frame', ({ entries }) => { + // for (const entry of entries) { + // if (!getActiveSpan()) { + // return; + // } + // const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime); + // const duration = msToSec(entry.duration); + // const span = startInactiveSpan({ + // name: 'Main UI thread blocked', + // op: 'ui.long-animation-frame', + // startTime, + // attributes: { + // [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics', + // }, + // }); + // if (span) { + // span.end(startTime + duration); + // } + // } + // }); } - - /** * Start tracking interaction events. */ diff --git a/packages/browser-utils/src/metrics/instrument.ts b/packages/browser-utils/src/metrics/instrument.ts index 9ce58b86a65f..e22a345e3116 100644 --- a/packages/browser-utils/src/metrics/instrument.ts +++ b/packages/browser-utils/src/metrics/instrument.ts @@ -10,7 +10,6 @@ import { onTTFB } from './web-vitals/onTTFB'; type InstrumentHandlerTypePerformanceObserver = | 'longtask' - | 'long-animation-frame' | 'event' | 'navigation' | 'paint' @@ -37,12 +36,6 @@ interface PerformanceEventTiming extends PerformanceEntry { interactionId?: number; } -interface PerformanceScriptTiming extends PerformanceEntry { - sourceCharPosition: number; - sourceFunctionName: string; - sourceUrl: string; -} - interface Metric { /** * The name of the metric (in acronym form). @@ -169,10 +162,6 @@ export function addPerformanceInstrumentationHandler( type: 'event', callback: (data: { entries: ((PerformanceEntry & { target?: unknown | null }) | PerformanceEventTiming)[] }) => void, ): CleanupHandlerCallback; -export function addPerformanceInstrumentationHandler( - type: 'long-animation-frame', - callback: (data: { entries: (PerformanceEntry & {scripts?: PerformanceScriptTiming[]})[] }) => void, -): CleanupHandlerCallback; export function addPerformanceInstrumentationHandler( type: InstrumentHandlerTypePerformanceObserver, callback: (data: { entries: PerformanceEntry[] }) => void,