Merge "Collect Web Vitals INP metric"
diff --git a/polygerrit-ui/app/constants/reporting.ts b/polygerrit-ui/app/constants/reporting.ts
index ae4aad9..be86863 100644
--- a/polygerrit-ui/app/constants/reporting.ts
+++ b/polygerrit-ui/app/constants/reporting.ts
@@ -93,6 +93,8 @@
   FID = 'FID',
   // WebVitals - Largest Contentful Paint (LCP): measures loading performance.
   LCP = 'LCP',
+  // WebVitals - Interaction to Next Paint (INP): measures responsiveness
+  INP = 'INP',
 }
 
 export enum Interaction {
diff --git a/polygerrit-ui/app/package.json b/polygerrit-ui/app/package.json
index 392b5a8..b71ad77 100644
--- a/polygerrit-ui/app/package.json
+++ b/polygerrit-ui/app/package.json
@@ -47,7 +47,7 @@
     "resemblejs": "^4.0.0",
     "rxjs": "^6.6.7",
     "safevalues": "^0.3.1",
-    "web-vitals": "^2.1.4"
+    "web-vitals": "^3.0.0"
   },
   "license": "Apache-2.0",
   "private": true
diff --git a/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts b/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
index dadf9e4..b81f6d5 100644
--- a/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
+++ b/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
@@ -16,7 +16,7 @@
   LifeCycle,
   Timing,
 } from '../../constants/reporting';
-import {getCLS, getFID, getLCP, Metric} from 'web-vitals';
+import {onCLS, onFID, onLCP, Metric, onINP} from 'web-vitals';
 
 // Latency reporting constants.
 
@@ -198,9 +198,10 @@
     );
   }
 
-  getCLS(metric => reportWebVitalMetric(Timing.CLS, metric));
-  getFID(metric => reportWebVitalMetric(Timing.FID, metric));
-  getLCP(metric => reportWebVitalMetric(Timing.LCP, metric));
+  onCLS(metric => reportWebVitalMetric(Timing.CLS, metric));
+  onFID(metric => reportWebVitalMetric(Timing.FID, metric));
+  onLCP(metric => reportWebVitalMetric(Timing.LCP, metric));
+  onINP(metric => reportWebVitalMetric(Timing.INP, metric));
 }
 
 // Calculates the time of Gerrit being in a background tab. When Gerrit reports
diff --git a/polygerrit-ui/app/yarn.lock b/polygerrit-ui/app/yarn.lock
index 5a91fc0..b1549b3 100644
--- a/polygerrit-ui/app/yarn.lock
+++ b/polygerrit-ui/app/yarn.lock
@@ -993,10 +993,10 @@
   resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
   integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
 
-web-vitals@^2.1.4:
-  version "2.1.4"
-  resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-2.1.4.tgz#76563175a475a5e835264d373704f9dde718290c"
-  integrity sha512-sVWcwhU5mX6crfI5Vd2dC4qchyTqxV8URinzt25XqVh+bHEPGH4C3NPrNionCP7Obx59wrYEbNlw4Z8sjALzZg==
+web-vitals@^3.0.0:
+  version "3.1.1"
+  resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-3.1.1.tgz#bb124a03df7a135617f495c5bb7dbc30ecf2cce3"
+  integrity sha512-qvllU+ZeQChqzBhZ1oyXmWsjJ8a2jHYpH8AMaVuf29yscOPZfTQTjQFRX6+eADTdsDE8IanOZ0cetweHMs8/2A==
 
 webidl-conversions@^3.0.0:
   version "3.0.1"