newrelic / newrelic-browser-agent

New Relic Browser Agent
Apache License 2.0
77 stars 40 forks source link

Consider web-vitals ^4.0.0 - INP tracking reports node names for un-mounted nodes (Currently ^3.1.0 / Locked to 3.5.1) #1053

Closed steven-hoffman-jomashop closed 1 month ago

steven-hoffman-jomashop commented 4 months ago

Summary

Upgrading to web-vitals version 4.0.0 would help with INP metrics. Currently, INP metrics can be reported with a 'blank' eventTarget. (Web vitals reports INP on hide/unmount of the page, by then the element contributing to the largest INP might have been removed).

Web vitals v4.0.0 includes code to track these elements and is able to report the element's name even when the element is removed. See: https://github.com/GoogleChrome/web-vitals/blob/v4.0.1/CHANGELOG.md?plain=1#L18 /https://github.com/GoogleChrome/web-vitals/pull/477.

Desired Behavior

Use web-vitals v4.0.0 to report INP eventTarget.

Possible Solution

Update to v4.0.0. (Current lock file value is 3.5.1: https://github.com/newrelic/newrelic-browser-agent/blob/v1.260.1/package-lock.json#L23210)

Also, 3.5.2 appears to contain a mitigation for this issue as well. (See: https://github.com/GoogleChrome/web-vitals/blob/v4.0.1/CHANGELOG.md?plain=1#L24)

Additional context

Note: v4.0.0 contains breaking changes to the metric format which would require either:

workato-integration[bot] commented 4 months ago

https://new-relic.atlassian.net/browse/NR-274181

metal-messiah commented 1 month ago

We will be upgrading to @4.x in an upcoming agent release. Thanks for suggesting this.

steven-hoffman-jomashop commented 2 weeks ago

Sounds good.