Skip to content

Commit

Permalink
fix: startTrackingLongAnimationFrames entry for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
horochx committed Jul 26, 2024
1 parent 9abdea5 commit 8b8f94d
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions packages/browser-utils/src/metrics/browserMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function startTrackingLongAnimationFrames(): void {
}
for (const entry of list.getEntries() as PerformanceLongAnimationFrameTiming[]) {
if (!entry.scripts[0]) {
break;
continue;
}

const startTime = msToSec((browserPerformanceTimeOrigin as number) + entry.startTime);
Expand All @@ -143,20 +143,19 @@ export function startTrackingLongAnimationFrames(): void {
const attributes: SpanAttributes = {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.ui.browser.metrics',
};

const initialScript = entry.scripts[0];
if (initialScript) {
const { invoker, invokerType, sourceURL, sourceFunctionName, sourceCharPosition } = initialScript;
attributes['browser.script.invoker'] = invoker;
attributes['browser.script.invoker_type'] = invokerType;
if (sourceURL) {
attributes['code.filepath'] = sourceURL;
}
if (sourceFunctionName) {
attributes['code.function'] = sourceFunctionName;
}
if (sourceCharPosition !== -1) {
attributes['browser.script.source_char_position'] = sourceCharPosition;
}
const { invoker, invokerType, sourceURL, sourceFunctionName, sourceCharPosition } = initialScript;
attributes['browser.script.invoker'] = invoker;
attributes['browser.script.invoker_type'] = invokerType;
if (sourceURL) {
attributes['code.filepath'] = sourceURL;
}
if (sourceFunctionName) {
attributes['code.function'] = sourceFunctionName;
}
if (sourceCharPosition !== -1) {
attributes['browser.script.source_char_position'] = sourceCharPosition;
}

const span = startInactiveSpan({
Expand Down

0 comments on commit 8b8f94d

Please sign in to comment.