-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(browser): Record standalone LCP spans #16591
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
base: develop
Are you sure you want to change the base?
Conversation
size-limit report 📦
|
// TODO: Figure out if we can switch to using whenIdleOrHidden instead of onHidden | ||
// use pagehide event from web-vitals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we most definitely don't want to switch to this, because idle
fires too early. Removed the comment I added in #16310
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: LCP Span Attribute Handling Mismatch
The standalone LCP span's attribute handling is inconsistent with the existing pageload span implementation. It unconditionally sets lcp.*
attributes (e.g., lcp.id
, lcp.url
, lcp.element
) without null/truthy checks. Additionally, it does not trim or truncate the lcp.url
attribute to 200 characters. The pageload span, however, performs these checks and truncates the URL, leading to different attribute reporting for the same LCP event and potentially very long URLs.
packages/browser-utils/src/metrics/lcp.ts#L106-L114
sentry-javascript/packages/browser-utils/src/metrics/lcp.ts
Lines 106 to 114 in a204305
if (entry) { | |
attributes['lcp.element'] = htmlTreeAsString(entry.element); | |
attributes['lcp.id'] = entry.id; | |
attributes['lcp.url'] = entry.url; | |
attributes['lcp.loadTime'] = entry.loadTime; | |
attributes['lcp.renderTime'] = entry.renderTime; | |
attributes['lcp.size'] = entry.size; | |
} |
Was this report helpful? Give feedback by reacting with 👍 or 👎
This PR implements sending standalone LCP spans as an opt-in feature.
Behaviour-wise, it's mostly aligned with our prior implementation of sending CLS standalone spans (#13056):
_experiments.enableStandaloneLcpSpans
option and treat it as opt-inlcp.*
span attributes as well as thelcp
measurement to the span(depending on if we merge #16589 or this first, we might need to readjust size limit)
closes #13063