Skip to content

fix(replay): Place CLS and INP web vitals at the right time - #24990

Open
Lms24 wants to merge 2 commits into
lms/fix-effect-tracer-clock-driftfrom
lms/fix-replay-cls-timestamp
Open

Lms24 wants to merge 2 commits into
lms/fix-effect-tracer-clock-driftfrom
lms/fix-replay-cls-timestamp

Conversation

@Lms24

@Lms24 Lms24 commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

The Replay integration adding web vital breadcrumbs used the metric value as the timestamp for CLS and INP web vitals. This is incorrect because that value is a score for CLS and a duration for INP, so both events always landed just after page load. This was a pre-existing bug, but it showed up during work on #23054. With this PR, CLS goes at the last layout shift and INP at the interaction, like we already do with spans in tracing. Both also get the time origin from when that happened, so they stay correct after a clock drift correction. A CLS of 0 has no layout shift, so it stays at the time origin.

@Lms24
Lms24 added this pull request to stack #24904 October 2, 2026 12:58
@Lms24 Lms24 changed the title fix(replay): Place CLS web vital at the last layout shift fix(replay): Place CLS and INP web vitals at the right time Oct 2, 2026
Lms24 and others added 2 commits October 2, 2026 16:11
The replay CLS event used the CLS score as its timestamp, so it always
landed a fraction of a millisecond after page load. Use the start time
of the last layout shift instead, like the CLS span in tracing does.
This also picks the time origin from when the shift happened.

Co-Authored-By: Claude <noreply@anthropic.com>
Like CLS, the replay INP event used the metric value as its timestamp.
For INP that value is a duration, so the event landed shortly after
page load. Use the start time of the interaction instead.

Co-Authored-By: Claude <noreply@anthropic.com>
@Lms24
Lms24 force-pushed the lms/fix-replay-cls-timestamp branch from 53c97f7 to 10bc6d6 Compare October 2, 2026 14:13
@Lms24
Lms24 marked this pull request as ready for review October 2, 2026 14:15
@Lms24
Lms24 requested a review from a team as a code owner October 2, 2026 14:15
@Lms24
Lms24 requested review from logaretm and msonnb and removed request for a team October 2, 2026 14:15
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.63 kB +0.39% +115 B 🔺
@sentry/browser - with treeshaking flags 27.78 kB +0.38% +103 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 27.68 kB +0.4% +109 B 🔺
@sentry/browser (incl. Tracing) 51.67 kB +0.44% +226 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 51.7 kB +0.46% +235 B 🔺
@sentry/browser (incl. Tracing, Profiling) 54.65 kB +0.35% +190 B 🔺
@sentry/browser (incl. Tracing, Replay) 91.3 kB +0.29% +259 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.24 kB +0.27% +216 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 96 kB +0.28% +261 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 108.95 kB +0.23% +242 B 🔺
@sentry/browser (incl. Feedback) 47.13 kB +0.2% +92 B 🔺
@sentry/browser (incl. sendFeedback) 34.69 kB +0.34% +117 B 🔺
@sentry/browser (incl. FeedbackAsync) 39.79 kB +0.28% +111 B 🔺
@sentry/browser (incl. Metrics) 30.66 kB +0.39% +118 B 🔺
@sentry/browser (incl. Logs) 30.94 kB +0.37% +111 B 🔺
@sentry/browser (incl. Metrics & Logs) 31.6 kB +0.38% +117 B 🔺
@sentry/react 31.46 kB +0.31% +96 B 🔺
@sentry/react (incl. Tracing) 54.05 kB +0.46% +246 B 🔺
@sentry/vue 37.72 kB +0.57% +213 B 🔺
@sentry/vue (incl. Tracing) 54.59 kB +0.49% +263 B 🔺
@sentry/svelte 29.65 kB +0.36% +105 B 🔺
@sentry/remix (Remix 3 client bundle) 55.97 kB +0.37% +201 B 🔺
CDN Bundle 31.33 kB +0.36% +111 B 🔺
CDN Bundle (incl. Tracing) 52.18 kB +0.39% +201 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.53 kB +0.21% +68 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 54.12 kB +0.39% +208 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 74.3 kB +0.13% +94 B 🔺
CDN Bundle (incl. Tracing, Replay) 89.74 kB +0.21% +180 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.7 kB +0.19% +172 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 95.9 kB +0.2% +184 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.9 kB +0.2% +189 B 🔺
CDN Bundle - uncompressed 92.4 kB +0.28% +252 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 154.96 kB +0.3% +462 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 98.87 kB +0.16% +157 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.91 kB +0.29% +462 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.49 kB +0.09% +205 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.75 kB +0.2% +529 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280.69 kB +0.19% +529 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 288.45 kB +0.19% +529 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 294.38 kB +0.19% +529 B 🔺
@sentry/nextjs (client) 56.54 kB +0.41% +226 B 🔺
@sentry/sveltekit (client) 52.08 kB +0.4% +206 B 🔺
@sentry/core/server 40.79 kB +0.5% +199 B 🔺
@sentry/core/browser 13.82 kB +1.41% +191 B 🔺
@sentry/node 144.93 kB +0.14% +200 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.32 kB +0.14% +113 B 🔺
@sentry/node - without tracing 93.54 kB +0.27% +250 B 🔺
@sentry/node - without channel injection 123.2 kB +0.2% +239 B 🔺
@sentry/aws-serverless 101.78 kB +0.22% +214 B 🔺
@sentry/cloudflare (withSentry) - minified 209.29 kB +0.33% +676 B 🔺
@sentry/cloudflare (withSentry) 519.54 kB +0.42% +2.14 kB 🔺

View base workflow run

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant