Skip to content

Commit 6896bd7

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 be3aec0 commit 6896bd7

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
@@ -434,9 +434,10 @@ export const browserTracingIntegration = ((options: Partial<BrowserTracingOption
434434
// This will generally always be defined here, because it is set in `setup()` of the integration
435435
// but technically, it is optional, so we guard here to be extra safe
436436
_collectWebVitals?.();
437+
const spanStreamingEnabled = hasSpanStreamingEnabled(client);
437438
addPerformanceEntries(span, {
438-
recordClsOnPageloadSpan: !enableStandaloneClsSpans,
439-
recordLcpOnPageloadSpan: !enableStandaloneLcpSpans,
439+
recordClsOnPageloadSpan: !spanStreamingEnabled && !enableStandaloneClsSpans,
440+
recordLcpOnPageloadSpan: !spanStreamingEnabled && !enableStandaloneLcpSpans,
440441
ignoreResourceSpans,
441442
ignorePerformanceApiSpans,
442443
});

0 commit comments

Comments
 (0)