Skip to content

Commit d4ff07d

Browse files
committed
cleanup
1 parent a5e95d9 commit d4ff07d

File tree

2 files changed

+23
-35
lines changed

2 files changed

+23
-35
lines changed

packages/browser-utils/src/metrics/browserMetrics.ts

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -124,32 +124,31 @@ export function startTrackingLongTasks(): void {
124124
* Start tracking long animation frames.
125125
*/
126126
export function startTrackingLongAnimationFrames(): void {
127-
addPerformanceInstrumentationHandler('long-animation-frame', ({ entries }) => {
128-
for (const entry of entries) {
129-
if (!getActiveSpan()) {
130-
return;
131-
}
132-
const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
133-
const duration = msToSec(entry.duration);
134-
135-
136-
const span = startInactiveSpan({
137-
name: 'Main UI thread blocked',
138-
op: 'ui.long-animation-frame',
139-
startTime,
140-
attributes: {
141-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
142-
},
143-
});
144-
if (span) {
145-
span.end(startTime + duration);
146-
}
147-
}
148-
});
127+
// NOTE: the current web-vitals version (3.5.2) does not support long-animation-frame, so
128+
// we should directly observe `long-animation-frame` events here instead of through the web-vitals
129+
// `observe` helper function.
130+
// addPerformanceInstrumentationHandler('long-animation-frame', ({ entries }) => {
131+
// for (const entry of entries) {
132+
// if (!getActiveSpan()) {
133+
// return;
134+
// }
135+
// const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
136+
// const duration = msToSec(entry.duration);
137+
// const span = startInactiveSpan({
138+
// name: 'Main UI thread blocked',
139+
// op: 'ui.long-animation-frame',
140+
// startTime,
141+
// attributes: {
142+
// [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
143+
// },
144+
// });
145+
// if (span) {
146+
// span.end(startTime + duration);
147+
// }
148+
// }
149+
// });
149150
}
150151

151-
152-
153152
/**
154153
* Start tracking interaction events.
155154
*/

packages/browser-utils/src/metrics/instrument.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { onTTFB } from './web-vitals/onTTFB';
1010

1111
type InstrumentHandlerTypePerformanceObserver =
1212
| 'longtask'
13-
| 'long-animation-frame'
1413
| 'event'
1514
| 'navigation'
1615
| 'paint'
@@ -37,12 +36,6 @@ interface PerformanceEventTiming extends PerformanceEntry {
3736
interactionId?: number;
3837
}
3938

40-
interface PerformanceScriptTiming extends PerformanceEntry {
41-
sourceCharPosition: number;
42-
sourceFunctionName: string;
43-
sourceUrl: string;
44-
}
45-
4639
interface Metric {
4740
/**
4841
* The name of the metric (in acronym form).
@@ -169,10 +162,6 @@ export function addPerformanceInstrumentationHandler(
169162
type: 'event',
170163
callback: (data: { entries: ((PerformanceEntry & { target?: unknown | null }) | PerformanceEventTiming)[] }) => void,
171164
): CleanupHandlerCallback;
172-
export function addPerformanceInstrumentationHandler(
173-
type: 'long-animation-frame',
174-
callback: (data: { entries: (PerformanceEntry & {scripts?: PerformanceScriptTiming[]})[] }) => void,
175-
): CleanupHandlerCallback;
176165
export function addPerformanceInstrumentationHandler(
177166
type: InstrumentHandlerTypePerformanceObserver,
178167
callback: (data: { entries: PerformanceEntry[] }) => void,

0 commit comments

Comments
 (0)