Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(replay): Update CLS and add TTFB for replays #12993

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

c298lee
Copy link
Member

@c298lee c298lee commented Jul 19, 2024

Relates to:

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

Copy link
Contributor

github-actions bot commented Jul 20, 2024

size-limit report 📦

Path Size
@sentry/browser 22.31 KB (0%)
@sentry/browser (incl. Tracing) 33.72 KB (0%)
@sentry/browser (incl. Tracing, Replay) 69.87 KB (+0.09% 🔺)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 63.2 KB (+0.09% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) 74.26 KB (+0.08% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) 86.6 KB (+0.1% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 88.45 KB (+0.07% 🔺)
@sentry/browser (incl. metrics) 26.62 KB (0%)
@sentry/browser (incl. Feedback) 38.98 KB (0%)
@sentry/browser (incl. sendFeedback) 26.93 KB (0%)
@sentry/browser (incl. FeedbackAsync) 31.54 KB (0%)
@sentry/react 25.08 KB (0%)
@sentry/react (incl. Tracing) 36.8 KB (0%)
@sentry/vue 26.45 KB (0%)
@sentry/vue (incl. Tracing) 35.61 KB (0%)
@sentry/svelte 22.44 KB (0%)
CDN Bundle 23.52 KB (0%)
CDN Bundle (incl. Tracing) 35.5 KB (0%)
CDN Bundle (incl. Tracing, Replay) 69.96 KB (+0.09% 🔺)
CDN Bundle (incl. Tracing, Replay, Feedback) 75.23 KB (+0.08% 🔺)
CDN Bundle - uncompressed 69 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 105.1 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 217.14 KB (+0.13% 🔺)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 229.87 KB (+0.12% 🔺)
@sentry/nextjs (client) 36.66 KB (0%)
@sentry/sveltekit (client) 34.39 KB (0%)
@sentry/node 111.57 KB (0%)
@sentry/node - without tracing 89 KB (0%)
@sentry/aws-serverless 98.17 KB (-0.01% 🔽)

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @c298lee I realize this is still in draft but once it's ready, would you mind adding a small PR description what motivates this change? Asking because I'm working on some CLS changes in the browserTracingIntegration and was just curious if there's something we should align on.

: undefined
: undefined;
return getWebVital(metric, 'cumulative-layout-shift', node);
const lastEntry = metric.entries[metric.entries.length - 1] as (PerformanceEntry & { sources?: LayoutShiftAttribution[] }) | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, looks like this aligns with the browserTracing logic where we also take the last entry. Sounds good to me!

https://github.com/getsentry/sentry-javascript/blob/develop/packages/browser-utils/src/metrics/browserMetrics.ts#L219

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a chance we can misalign (say we change the behavior in perf later?)
If so, is there a world we create some convinience function on a shared/core packaged used by both? or is that just not worth it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid we are going to missalign a bit at least: I opened #13056 with an experimental change and realized that it breaks how we listen to LCP for replay breadcrumbs.

However, I think we just need to be aware that we're tracking CLS a bit differently for replay than for performance insights. In Replay we can collect CLS whenever it emits (though I guess we need to debounce that a bit to acomodate for layout shift bursts) but we can't do the same easily for insights.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll for now probably decouple the listeners for browserTracing and replay: #13056 (comment)

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.

3 participants