-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Web Vitals are captured incorrectly #13006
Comments
Hmm I'm not sure if both are related. Some observations so far:
|
I have also found that web-vitals data for my site are seemingly incorrect. We have long recorded web vitals data using the Below shows the difference of LCP, TTFB and FCP between sentry reported values (left) and ones from the web-vitals (right) package ( p75p50LCP seems to be the most off - significantly different in many cases. Individual examples (self-hosted so can't link examples)On individual traces, here is an example of the sentry values being different to our custom metric and also not lining up with the spans in the trace Here can see the difference of start time of the request and the start time of the first paint span is 1723035794.5266 - 1723035793.3029 = 1.22s which is still lower than our custom metric but closer than the sentry reported one. This also shows LCP > FCP which incorrect as mentioned in the original post. We have many examples of individual traces like this. |
Hey @md384 thanks for providing this data! I can see a couple of things that might explain the discrepancies:
I'm curious: How do you use the |
Unrelated to my comment above but adding it here: A further example of incorrect LCP/FP/FCP values: https://sentry-sdks.sentry.io/performance/trace/10e33722186ea42a792504e313d192e5/?field=title&field=event.type&field=project&field=user.display&field=timestamp&name=All+Events&node=txn-e507fc916a5f4d3f8bba7a1a9fb1032d&node=txn-b7ddd0be9dc04146be202f3865bf3cc6&project=4504796902588416&query=&sort=-timestamp&source=discover&statsPeriod=10m×tamp=1723115339&yAxis=count%28%29 |
We do not set One other thing, is that the metric counts for my custom metric is consistently lower than the sentry count We do have a browser guard ( |
@md384 which version of the |
Currently |
I got to know that LCP log are taken right after nextjs-hydration. But originally in ssr, FCP and LCP can be stamped before hydration. |
We collect the LCP value when the In a |
@Lms24 confirmed the same results with web-vitals 4.2.3 For LCP which has the largest discrepancy TTFB and FCP looks the same as before too - typically TTFB is a little higher in sentry and FCP a little lower in sentry vs the web-vitals measurements |
Thank you for the added detail, we will continue to look into this & investigate this! |
Hello everyone, after investigating, I'm fairly sure we found the root cause of the LCP/FCP/FP values being off: We normalize LCP/FCP/FP values in a very weird way in the SDK, where it looks like we try to re-calculate LCP from the beginning of the pageload transaction instead of what the browser gives us. I think the reason for this is that we need to draw the vertical line for LCP in the trace view but there are a couple of fundamental problems:
I will check what removing the LCP/FCP/FP value normalization does to the values shown in the Sentry UI. My hunch is that they'll be much more accurate. We need to check the impact on the trace view especially though. |
Hey @keradus thanks for the callout! Yeah, let's close this for now. We haven't received as many reports about incorrect web vitals recently. With all the changes made recently, I think it's fair to close. To anyone reading this issue: If you observe web vitals that appear incorrect, please open a new issue with a detailed description and reproduction of the problem. Thank you! |
Description
It seems like the SDK is reporting completely wrong webvitals: Trace
Looking through some traces in Sentry this did not seem to be an issue in v7.
The text was updated successfully, but these errors were encountered: