Skip to content

Commit f2291b8

Browse files
logaretmclaude
andcommitted
fix(browser): Skip CLS/LCP measurements on pageload span when streaming
When span streaming is enabled, CLS and LCP are emitted as streamed spans. Previously they were also recorded as measurements on the pageload span because the flags only checked enableStandaloneClsSpans and enableStandaloneLcpSpans, which default to undefined. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ef09f2f commit f2291b8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/browser/src/tracing/browserTracingIntegration.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,10 @@ export const browserTracingIntegration = ((options: Partial<BrowserTracingOption
457457
// This will generally always be defined here, because it is set in `setup()` of the integration
458458
// but technically, it is optional, so we guard here to be extra safe
459459
_collectWebVitals?.();
460+
const spanStreamingEnabled = hasSpanStreamingEnabled(client);
460461
addPerformanceEntries(span, {
461-
recordClsOnPageloadSpan: !enableStandaloneClsSpans,
462-
recordLcpOnPageloadSpan: !enableStandaloneLcpSpans,
462+
recordClsOnPageloadSpan: !spanStreamingEnabled && !enableStandaloneClsSpans,
463+
recordLcpOnPageloadSpan: !spanStreamingEnabled && !enableStandaloneLcpSpans,
463464
ignoreResourceSpans,
464465
ignorePerformanceApiSpans,
465466
});

0 commit comments

Comments
 (0)