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

feat(replay): Use SDK value for LCP #44868

Merged
merged 6 commits into from
Feb 28, 2023
Merged

Conversation

billyvg
Copy link
Member

@billyvg billyvg commented Feb 18, 2023

Changes LCP breadcrumb rendering to use data.value instead of trying to calculate the value (which ends up resulting in incorrect values as it uses the replay start timestamp, so LCP from a refresh will be wrong).

Related getsentry/sentry-javascript#7225

Note that the above PR changes start + end timestamps to be equal since LCP is a single point in time rather than a range. The above PR also corrects the timestamp to be when the LCP occurs (rather than the previous start timestamp which is wrong and generally ends up around page load time).

Adds a warning for old SDK versions:
image

Changes LCP breadcrumb rendering to use `data.value` instead of trying to calculate the value (which ends up resulting in incorrect values as it uses the replay start timestamp, so LCP from a refresh will be wrong).

Related getsentry/sentry-javascript#7225
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 18, 2023
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
src/sentry/static/sentry/dist/entrypoints/app.js 19.9 KB (+0.02% 🔺)
src/sentry/static/sentry/dist/entrypoints/sentry.css 32.99 KB (0%)

@billyvg billyvg marked this pull request as ready for review February 18, 2023 00:44
@billyvg billyvg requested a review from a team as a code owner February 18, 2023 00:44
Comment on lines 10 to 11
if (crumb.data?.value !== undefined) {
return `${crumb.data.value}ms`;
Copy link
Member Author

Choose a reason for hiding this comment

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

This means replays with older SDKs will not have any value, but only the first LCP value would be accurate. Wonder if we stick a SDK upgrade CTA here 😄

Copy link
Member

Choose a reason for hiding this comment

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

nothing is better than something which is wrong imo.

if we're doing a cta to upgrade the sdk we should be looking at the most recent replay and it's version, because they might've just updated and this a replay from last week that's being viewed

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point re: most recent replay -- I think we'll make the CTA just a tooltip so it's less intrusive and keep it simple by looking at the replay's version.

Copy link
Member

@ryan953 ryan953 left a comment

Choose a reason for hiding this comment

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

show the timestamp we get from the sdk, less frontend converting values. :shipit:

if (crumb.timestamp && startTimestampMs) {
return `${new Date(crumb.timestamp).getTime() - startTimestampMs}ms`;
if (crumb.data?.value !== undefined) {
return `${Math.round(crumb.data.value)}ms`;
Copy link
Member Author

Choose a reason for hiding this comment

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

just float things

Comment on lines +16 to +27
if (crumb.data?.duration !== undefined) {
// this means user is using an old SDK where LCP values are not
// always correct. Prompt them to upgrade
return (
<Tooltip
title={t(
'This replay uses a SDK version that is subject to inaccurate LCP values. Please upgrade to the latest version for best results if you have not already done so.'
)}
>
<IconWarning />
</Tooltip>
);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is new since last PR -- ss in PR desc.

@@ -74,7 +75,9 @@ function BreadcrumbItem({
) : null}
</TitleContainer>

<Description title={description}>{description}</Description>
<Tooltip title={description} showOnlyOnOverflow>
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously it was expecting a string, now it uses <Tooltip> so that we can also hide the native tooltip when it is not overflowing.

@billyvg billyvg merged commit bc92124 into master Feb 28, 2023
@billyvg billyvg deleted the feat-replay-better-lcp-value branch February 28, 2023 20:40
jan-auer added a commit that referenced this pull request Mar 1, 2023
* master: (37 commits)
  ref(ppf): Don't use --commit-batch-size for futures queue length (#45182)
  feat(codecov-v2): Add more logging (#45225)
  fix(alerts): Center table items on alert history page (#45226)
  feat(CapMan): Pass `tenant_ids` to Snuba (#44788)
  ref(db): Drop `project_id` from Environment (model state) (#45207)
  chore(profiling): Rename context in profiles task (#45208)
  feat(replays): Improve index page query performance (#45098)
  chore(issue assignment): Add logging for`GroupOwner` auto assignment (#45142)
  fix(hybrid-cloud): Uncache organization when queueing it for deletion (#45213)
  fix(perf): Navigating to Transaction Summary from Trends widget should persist custom date selection (#45190)
  fix(pageFilter): Fix overflow (#45169)
  ref(git hooks): Only suggest autoupdate variable when pulling if not already set (#45179)
  fix(dashboard): Include dashboard filters in widget viewer (#45106)
  fix(alerts): Remove null projects from alerts list (#45202)
  feat(replay): Update Inline replay onboarding img to support dark mode (#45084)
  __iexact reduce call has default value now. (#45206)
  feat(replay): Use SDK value for LCP (#44868)
  chore(hybrid-cloud): breaking foreign keys (#45203)
  Revert "ref(db): Drop `project_id` from Environment (model state) (#45094)"
  ref(db): Drop `project_id` from Environment (model state) (#45094)
  ...
@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants