You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug: LCP attribution can include resourceLoadDelay attribution timings far greater than the LCP value in cases where onTTFB discards the navigation data
#439
Closed
vanderhoop opened this issue
Mar 5, 2024
· 1 comment
· Fixed by #440
Expected behavior: the LCP attribution's resourceLoadDelay does not exceed the reported LCP value.
Actual behavior: the resourceLoadDelay can currently exceed the reported LCP value in cases where onTTFB would discard the navigation data as untrustworthy.
Example data from a real page view:
constreported={lcp: 2000,lcpAttributionResourceLoadDelay: 17653.7,// note the discrepancy between onTTFB and lcpAttributionTTFBonTTFB: null,lcpAttributionTTFB: 3300.3,// FWIW, the resource below has a `Timing-Allow-Origin: *` headerlcpAttributionResourceUrl: "https://lh3.googleusercontent.com/qE-ZWFf6Q8GMIXN8_dCUU118GmoS43Uc8qW4GKTU64PyuLgqnj5QBpSH14W7UJH3OgXqo-5q_MwG5VWOBSdR_yE=h800-c",lcpAttributionResourceLoadTime: 0,lcpAttributionCallbackPerformanceNowTimestampForDebugging: 2000,}
Suspicion:
At the moment, onTTFB issues an early return of undefined in a handful of cases:
It should be noted that the calculation of resourceLoadDelay can end up relying on the navigation entry for both sides of the subtraction seen above due to the derivation of lcpRequestStart
Apply the guard clause seen in onTTFB within onLCP attribution such that it discards all LCP data as untrustworthy in these cases
Apply the guard clause seen in onTTFB within onLCP attribution such that only the TTFB-dependent attribution fields are either a) discarded or b) clamped somehow
The text was updated successfully, but these errors were encountered:
Expected behavior: the LCP attribution's
resourceLoadDelay
does not exceed the reported LCP value.Actual behavior: the
resourceLoadDelay
can currently exceed the reported LCP value in cases whereonTTFB
would discard the navigation data as untrustworthy.Example data from a real page view:
Suspicion:
At the moment,
onTTFB
issues an early return of undefined in a handful of cases:web-vitals/src/onTTFB.ts
Lines 80 to 86 in 8058a00
However, the
resourceLoadDelay
relies on navigation (TTFB) data without the protections issued above:web-vitals/src/attribution/onLCP.ts
Line 64 in 8058a00
It should be noted that the calculation of
resourceLoadDelay
can end up relying on the navigation entry for both sides of the subtraction seen above due to the derivation oflcpRequestStart
web-vitals/src/attribution/onLCP.ts
Lines 44 to 51 in 8058a00
Where
activationStart
isweb-vitals/src/attribution/onLCP.ts
Line 34 in 8058a00
Some initial options that spring to mind:
onTTFB
withinonLCP
attribution such that it discards all LCP data as untrustworthy in these casesonTTFB
withinonLCP
attribution such that only the TTFB-dependent attribution fields are either a) discarded or b) clamped somehowThe text was updated successfully, but these errors were encountered: