Add web-vitals reporting

PR: https://github.com/theforeman/foreman/pull/8812

Web Vitals is an initiative by Google to provide unified guidance for quality signals that are essential to delivering a great user experience on the web.

We will console.warn if one of the following values is too slow:

  • Largest Contentful Paint (LCP): measures loading performance. To provide a good user experience, LCP should occur within 2.5 seconds of when the page first starts loading.
  • First Input Delay (FID): measures interactivity. To provide a good user experience, pages should have a FID of 100 milliseconds or less.
  • Cumulative Layout Shift (CLS): measures visual stability. To provide a good user experience, pages should maintain a CLS of 0.1. or less.

Let me start of with saying that I appreciate a faster UI. Recently I used a Foreman 1.24 instance and I noticed how much faster that felt. It took a lot less time to render pages. Any effort to get back to those speeds would be nice.

My biggest concern is that we should never send any metrics to some third party on the internet. That has always been an implicit agreement we had with our users. From the PR and the linked website I can’t quite make out if that would remain true. Could you answer that part?

Other than that I wonder about actionability. Can we somehow figure out the slowest pages? Perhaps we can somehow tie this into the existing server side metrics we have. @lzap may know more about that.

1 Like

maybe it was due to the fact we used turbolinks? I hope we can do something about it in the upcoming releases.

in my PR I just console.log the calculated performance into the browser’s web console.
if we will want in the future to send it for analytics we can discuss it with the community, but I am not sure we need to.

maybe we can add it to our CI integration test somehow? and keep a record of how fast are pages and get some warning if the deltas are too big (although it can relate to environment issues as well)

That could be interesting. Even if we see relative values means we would know which pages to focus on.

1 Like

If this contacts Google servers in anyway, this is a no-go from me. This week, Facebook went down for 6 hours because an operator accidentally sent BGP messages and all routing to Facebook datacenters was dropped. Operators were unable to connect to management servers, they had to literally walk in the datacenters to fix it. And all these 6 hours, millions of sites which use things like Facebook login, Facebook messages, Facebook like buttons, comments, whatever - they were out of service or in limited service.

Also, Foreman is not a typical web app for the masses, we shouldn’t be concerned with milliseconds when our processes in the background backend systems take ages. I believe we should not invest much time into micro-optimizing and spend our time working on real pains that our users have. Things like slow pages due to inncorrect ActiveRecord use, slow SQL queries, missing indexes, unnecessary indexes, slow BMC operations, orchestration hooked via ActiveRecords leading to some updates taking forever blocking the whole UI.