Skip to content
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

Measuring Core Web Vitals (RUM) #1

Open
addyosmani opened this issue Dec 11, 2020 · 16 comments
Open

Measuring Core Web Vitals (RUM) #1

addyosmani opened this issue Dec 11, 2020 · 16 comments

Comments

@addyosmani
Copy link
Member

It would be helpful to have CWV measurement in place early on in the project so we can see how the metrics trend as optimizations are experimented with.

I believe https://github.com/nuxt-community/web-vitals-module is the current official solution Nuxt.js recommends (need to check if it is baked in now...)

Once we decide where dev/staging should be deployed, I will get GA setup so we have an ID we can use.

@pi0
Copy link
Member

pi0 commented Dec 12, 2020

Hi Addy, indeed that is the module. We moved best community implementation to nuxt-community org and almost done a full rewrite. I will try to publish it this weekend and updating you :)

@addyosmani
Copy link
Member Author

I will try to publish it this weekend and updating you :)

That sounds promising. Thanks so much, @pi0! 😄

anton-karlovskiy added a commit that referenced this issue Dec 21, 2020
[refactor] push the changes done by Pooya
@anton-karlovskiy
Copy link
Member

anton-karlovskiy commented Dec 24, 2020

Hi @addyosmani @pi0 @danielroe

Could you please pause merging any PRs to the dev branch until we have set up measurement integrations like Lighthouse or WebPageTest etc?

Now as we have set up Vercel configuration, we can obtain a unique URL for a PR.
I think the purpose of getting such a unique URL is to measure the performance like Core Web Vitals at a specific point.
Actually, in the last Next.js project, I used to run Lighthouse and WebPageTest after a major PR of changes, and it was sort of hard work that consumes a lot of time. :)

I think it's very important for us to know whether a specific PR brings improvement or regression in the performance so that we can make sure that our optimization approaches have been right and correct them if a regression occurs at an early stage.
To be honest, SpeedCurve is good for monitoring the trends of the performance but it runs testing daily not per PR.
As far as I'm concerned, it's good for us to have a system where performance testing is done per PR rather than daily.

I think we can set up an automatic measuring process as a CI/CD action.
I guess there are some options:

I'm going to dig into which one is fit for us. @addyosmani I'd like your suggestions here. :)
I guess it would be ideal if we could use Vercel Analytics but it appears that it's not available for Nuxt.js projects.
analytics
Re: nuxt-modules/web-vitals#13, https://github.com/vercel/nuxt-plugin-vercel

@addyosmani
Copy link
Member Author

Thanks Anton. In this case, I think Lighthouse CI using GitHub actions might be the perfect fit for continuous performance recordings. When I've used them, I've found the clear "diff" of user-experience changes in the enhanced Lighthouse CI report to help me understand what metrics or audits were seeing a shift.

Perhaps for this project, we can setup Lighthouse CI and only do periodic checks using WebPageTest where we feel we really need to be able to compare the filmstrip or waterfalls the way they visually present them?

@anton-karlovskiy
Copy link
Member

anton-karlovskiy commented Jan 13, 2021

Thanks Anton. In this case, I think Lighthouse CI using GitHub actions might be the perfect fit for continuous performance recordings. When I've used them, I've found the clear "diff" of user-experience changes in the enhanced Lighthouse CI report to help me understand what metrics or audits were seeing a shift.

Perhaps for this project, we can set up Lighthouse CI and only do periodic checks using WebPageTest where we feel we really need to be able to compare the filmstrip or waterfalls the way they visually present them?

Hi @addyosmani
I've checked all about Lighthouse CI using GitHub actions and found some issues.

  1. The main one is the period during which the collected Lighthouse reports will remain in temporary-public-storage.
    temporary-public-storage
    We would have to set up Lighthouse CI Server in order to keep the records for as long as we want.
  2. And the other one is that it seems like Lighthouse CI would run locally rather than against the Vercel URL.
    locally

On the other hand, it appears that the Lighthouse integration via Vercel provides all we need:
vercel
I guess it's free too so I just wondered if using the Vercel's Lighthouse would be quicker.

What are your thoughts?

@danielroe
Copy link
Member

You can set up a GitHub Actions workflow that triggers on Vercel deployments - it will receive the unique preview URL from Vercel and you can then run lhci (via Action or custom script) against that deployment URL.

@anton-karlovskiy
Copy link
Member

anton-karlovskiy commented Jan 13, 2021

@danielroe Thank you for your information.

We have already integrated Vercel into our repository so every time a PR against the dev branch is created, the unique preview URLs are being generated now.
The point is:

  1. can we run LHCI against those preview URLs from Vercel, not from GitHub actions?
  2. we would still have to set up Lighthouse CI server in order to keep the records for as long as we want.

cc @addyosmani

@danielroe
Copy link
Member

danielroe commented Jan 13, 2021

I was responding particularly to this line in your previous comment:

And the other one is that it seems like Lighthouse CI would run locally rather than against the Vercel URL.

More details here

@anton-karlovskiy
Copy link
Member

anton-karlovskiy commented Jan 13, 2021

@addyosmani

I've tried Vercel's Lighthouse and I think we do not have much control over the process.
vercel-lighthouse
For example, it appears that we are not able to set up the number of counts, several URLs etc that we can do with Lighthouse CI using GitHub actions.

https://vercel.com/nuxt-movies/nuxt-movies/integrations/icfg_nYDnSDMCuBZzqdMbpRsmD5ac

@anton-karlovskiy
Copy link
Member

anton-karlovskiy commented Jan 14, 2021

@addyosmani

Could you please set up the repository secrets like so?
FRONTEND_URL: http://localhost:3000
API_KEY: 9a31326bc179b029cd4513c489628e79
API_LANG: en-US
API_COUNTRY: GB
API_YOUTUBE_KEY:
secrets

And also please set up up a GitHub status check by following https://web.dev/lighthouse-ci/#github-status-checks?
Thank you.

@addyosmani
Copy link
Member Author

addyosmani commented Jan 15, 2021 via email

@anton-karlovskiy
Copy link
Member

@addyosmani

I've got a question about measuring the CLS.

I've tried measuring the CLS using Web Vitals Chrome extension.

  • Version 87.0.4280.141 Google Chrome
    CLS-at-Version 87 0 4280 141
  • Version 90.0.4392.0 Google Chrome Canary
    CLS-at-Version 90 0 4392 0-canary

The measured CLS results are quite different.
Could you please teach me the reason?
Thank you.

@addyosmani
Copy link
Member Author

One reason this may be is that CLS as implemented in Chrome has received some updates to better account for how developers render modern content in Chrome 88 and 89: https://chromium.googlesource.com/chromium/src/+/master/docs/speed/metrics_changelog/cls.md.

@anton-karlovskiy
Copy link
Member

anton-karlovskiy commented Jan 18, 2021

@addyosmani

Then which version should we rely on in checking CLS?
cls-changelog

@addyosmani
Copy link
Member Author

In this case newer Chrome is always the more reliable (Chrome 90) :)

@anton-karlovskiy
Copy link
Member

anton-karlovskiy commented Jan 19, 2021

@addyosmani

Is Heroku being used here as a workaround for GitHub actions not doing the full suite of checks? I'd rather that we fix this directly vs. adding another service into the mix. Here's what I will do tomorrow (today is public holiday in the U.S): I'll add our maintainer for LHCI to the repo and ask for his help debugging what we are seeing. Ideally it shouldn't require someone self-hosting to work around this issue (I worry if we're having to do this the product is not working correctly for others...).

Now I think we can see the full suite of checks:
full-checks

The reason why I think we should use Heroku as a Lighthouse CI Server is to keep the records for long term and other benefits the Lighthouse CI Server can give like:

The Lighthouse CI server provides a dashboard for exploring historical Lighthouse reporting. It can also act as a private, long-term datastore for Lighthouse reports.

Re: https://web.dev/lighthouse-ci/#server-setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants