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 web vitals to align with browserTracing #13058

Merged
merged 13 commits into from
Jul 30, 2024

Conversation

c298lee
Copy link
Member

@c298lee c298lee commented Jul 25, 2024

NodeId has been replaced with nodeIds which now accepts several nodes since CLS scores are cumulative. Also updated CLS metrics to match CLS captured from browserTracing.

Relates to getsentry/sentry#69881

Copy link
Contributor

github-actions bot commented Jul 25, 2024

size-limit report 📦

Path Size
@sentry/browser 22.45 KB (0%)
@sentry/browser (incl. Tracing) 34.22 KB (0%)
@sentry/browser (incl. Tracing, Replay) 70.28 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 63.61 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) 74.68 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) 87.26 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 89.11 KB (+0.03% 🔺)
@sentry/browser (incl. metrics) 26.75 KB (0%)
@sentry/browser (incl. Feedback) 39.37 KB (0%)
@sentry/browser (incl. sendFeedback) 27.06 KB (0%)
@sentry/browser (incl. FeedbackAsync) 31.7 KB (0%)
@sentry/react 25.22 KB (0%)
@sentry/react (incl. Tracing) 37.22 KB (0%)
@sentry/vue 26.6 KB (0%)
@sentry/vue (incl. Tracing) 36.06 KB (0%)
@sentry/svelte 22.58 KB (0%)
CDN Bundle 23.64 KB (0%)
CDN Bundle (incl. Tracing) 35.88 KB (0%)
CDN Bundle (incl. Tracing, Replay) 70.29 KB (+0.05% 🔺)
CDN Bundle (incl. Tracing, Replay, Feedback) 75.56 KB (+0.04% 🔺)
CDN Bundle - uncompressed 69.37 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 106.31 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 218.04 KB (+0.04% 🔺)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 230.86 KB (+0.04% 🔺)
@sentry/nextjs (client) 37.08 KB (0%)
@sentry/sveltekit (client) 34.81 KB (0%)
@sentry/node 114.55 KB (0%)
@sentry/node - without tracing 89.33 KB (-0.01% 🔽)
@sentry/aws-serverless 98.5 KB (0%)

@c298lee c298lee marked this pull request as ready for review July 29, 2024 16:02
@c298lee c298lee requested a review from a team as a code owner July 29, 2024 16:02
Copy link
Member

@billyvg billyvg left a comment

Choose a reason for hiding this comment

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

Does the frontend support node being an array? We'll want to make sure it's compatible.

It would be better though if we sent it as a new property, e.g. nodes. Otherwise it can break self-hosted since the UI is not expecting an array. With a different property, old UIs will not be able to highlight the nodes, but at least it shouldn't break the app.

Comment on lines 239 to 240
const nodeIds: number[] = [];
if (Array.isArray(node)) {
Copy link
Member

Choose a reason for hiding this comment

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

This might be easier to follow and less code:

Suggested change
const nodeIds: number[] = [];
if (Array.isArray(node)) {
const nodes = Array.isArray(node) ? node : [];
const nodeIds = nodes.map(node => record.mirror.getId(node);

@@ -225,13 +229,24 @@ export function getInteractionToNextPaint(metric: Metric): ReplayPerformanceEntr
export function getWebVital(
metric: Metric,
name: string,
node: Node | undefined,
node: Node | Node[] | undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Is getWebVital a public function? It might be better to change the parameters so that it accepts Node[] | undefined.

@c298lee c298lee requested review from billyvg and mydea July 30, 2024 05:44
Comment on lines 235 to 236
const nodeIds = nodes ? nodes.map(node => record.mirror.getId(node)) : undefined;

Copy link
Member

Choose a reason for hiding this comment

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

Let's move this inline with L246

@c298lee c298lee merged commit 67a067a into develop Jul 30, 2024
127 checks passed
@c298lee c298lee deleted the cl/update-cls branch July 30, 2024 17:13
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.

2 participants