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

updates for using lighthouse v3 #178

Merged
merged 26 commits into from
Sep 12, 2018
Merged

updates for using lighthouse v3 #178

merged 26 commits into from
Sep 12, 2018

Conversation

denar90
Copy link
Collaborator

@denar90 denar90 commented May 28, 2018

Core of changes to use LH v3

  • updated perf config
  • cleaned up metrics adapter
  • cleaned types

Has to be merged after final release and test of v3 version.

lib/index.ts Outdated
const parseChromeFlags = require('lighthouse/lighthouse-cli/run').parseChromeFlags;
const perfConfig: any = require('./lh-config');
const perfConfig: any = require('lighthouse/lighthouse-core/config/plots-config.js');
perfConfig.extends = 'lighthouse:default';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: already fixed in LH master branch and has to be removed

@denar90
Copy link
Collaborator Author

denar90 commented May 30, 2018

it will be nice if someone takes a look at it before further work on it...
thanks)

Copy link
Owner

@paulirish paulirish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in 3.0 you have the choice of using lantern's simulated throttling or keep using the devtools throttling. I would recommend using lantern (on by default via the default lighthouse config), but maybe a user should be able to change this.

lib/index.ts Outdated
const parseChromeFlags = require('lighthouse/lighthouse-cli/run').parseChromeFlags;
const perfConfig: any = require('./lh-config');
const perfConfig: any = require('lighthouse/lighthouse-core/config/plots-config.js');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should just provide a config file here in this repo. We don't have much reason to maintain that plots-config fwiw. :)

metrics audit

while everything you need is in the new audit called metrics it doesnt come with human-readable names. Since you provide those in messages.ts maybe its fine and all you really need is metrics. I think this could work.

image

individual audits

If you really need all the individual audits:

module.exports = {
  extends: 'lighthouse:default',
  settings: {
    onlyAudits: defaultConfig.categories.performance.auditRefs
	.filter(a => a.group && a.group === 'metrics')
	.map(a => a.id)
  },
};

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paul, thanks. Would you like to keep all metrics we already have or reduce their number? I'm kinda confused because I faced that people just ignore FCP and rely only on FMP in perf aduits/case studies etc. As result with 3.0 and plots-config I thought maybe trends were changed...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way we look at the problem now is:

key metrics

  • FCP
  • Speed Index
  • TTI

worthwhile diagnostic metrics

  • FMP
  • FCPUIdle

EIL is interesting but could use some work. it'll also change substantially in the future. And it's not on the same timescale as the others.

FirstVC should mostly be duplicated by FCP.

VizComplete is cool unless it marked the wrong thing, in which case it and Speed Index are totally useless. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulirish but VizComplete is not part of metrics.

auditRefs: [
        {id: 'first-contentful-paint', weight: 3, group: 'metrics'},
        {id: 'first-meaningful-paint', weight: 1, group: 'metrics'},
        {id: 'speed-index', weight: 4, group: 'metrics'},
        {id: 'interactive', weight: 5, group: 'metrics'},
        {id: 'first-cpu-idle', weight: 2, group: 'metrics'},
        {id: 'estimated-input-latency', weight: 0, group: 'metrics'},

Should it be added there?
Or, should we use pwmetrics-events and get it manually?

lib/metrics.ts Outdated
lighthouseVersion: res.lighthouseVersion,
initialUrl: res.initialUrl,
url: res.url
initialUrl: res.finalUrl,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initial is final?

i'd recommend adopting requestedUrl and finalUrl names for this metrics export.

case 'estimated-input-latency':
return 'Estimated Input Latency';
case 'first-cpu-idle':
return 'Time to First Interactive';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the metric is renamed so it'd be best to call it "First CPU Idle" now

@@ -44,24 +44,16 @@ const getMessage = function (messageType: string, ...args: any[]) {
return `No matching message prefix: ${args[0]}`;
case 'METRIC_IS_UNAVAILABLE':
return `Sorry, ${args[0]} metric is unavailable`;
case 'ttfcp':
case 'first-meaningful-paint':
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems wrong.

in 3.0 FCP is both in 'metrics' audit and its own. i would def recommend showing both FCP and FMP in pwmetrics. (plots doesnt have FCP)

@denar90
Copy link
Collaborator Author

denar90 commented Jun 8, 2018

at list tests passed ;)

// Copyright 2018 Google Inc. All Rights Reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE

export default {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this one useful for people using expectations and stuff. What they need is just import our constants and use them for expectations config.

const METRICS = require('pwmetrics/lib/metrics-adapter/metrics');

module.exports = {
  url: 'http://my-awesome-site.com'
  flags: {
    expectations: true
  },
  expectations: {
    [METRICS. TTFCP]: {
       warn: '>=1000',
       error: '>=2000'
    }
  }
}

Other then that cleaner for our code to have map metrics ids.

@denar90
Copy link
Collaborator Author

denar90 commented Jul 2, 2018

@paulirish we are good to go after solving #178 (comment)
Then I'll do manual regression and update docs.

Since LH 3.0 is done, It will be nice to announce pwmetrics updates right after LH announcement.

@denar90
Copy link
Collaborator Author

denar90 commented Aug 4, 2018

@paulirish can you take a look here 👀?

@denar90
Copy link
Collaborator Author

denar90 commented Aug 11, 2018

Opened questions are:

  • handle vizcomplete
  • gulp example still failes on CI :( (we can live with that for now)
  • code review

@denar90 denar90 changed the title updates for using lighthouse v3, wip updates for using lighthouse v3 Aug 11, 2018
package.json Outdated
"chrome-launcher": "^0.10.2",
"google-auth-library": "^0.10.0",
"googleapis": "^16.0.0",
"lighthouse": "^2.9.4",
"lighthouse": "3.0.0",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can bump it to 3.0.3 now

package.json Outdated
"mocha": "^3.2.0",
"sinon": "^1.17.7",
"sinon-chai": "^2.8.0",
"typescript": "^2.0.3"
"typescript": "2.9.1-insiders.20180516",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can go to 3.0.0 now too :)

package.json Outdated
"mocha": "^3.2.0",
"sinon": "^1.17.7",
"sinon-chai": "^2.8.0",
"typescript": "^2.0.3"
"typescript": "2.9.1-insiders.20180516",
"vscode-chrome-debug-core": "3.23.8"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why this is added. was it types?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fixed in LH now, so can be dropped 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, still needed because without that tsc build failed

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh. weird. we're about to remove that dependency: GoogleChrome/lighthouse#5836

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably we will wait for PR to be merged...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropped 💥
just waiting for next LH release

.travis.yml Outdated
- npm install -g --no-progress yarn@v0.22.0
- lighthouse-extension/node_modules
- lighthouse-viewer/node_modules
- /home/travis/.rvm/gems/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the two lighthouse-* folders dont make sense to me here.
and i dont think you're running ruby, so you can nuke this one too.

lib/index.ts Outdated
@@ -107,15 +98,15 @@ class PWMetrics {
}

if (resultHasExpectationErrors && this.flags.expectations) {
throw new Error(messages.getMessage('HAS_EXPECTATION_ERRORS'));
console.log(getMessage('HAS_EXPECTATION_ERRORS'));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you want to let things continue in this case? im fine with that, just pointing out that the behavior is changing. :)
probably should console.error() if its staying non-throwing.

@@ -57,22 +39,19 @@ const runPwmetrics = function() {
* @param {Object} results - Pwmetrics results obtained through Lighthouse
*/
const handleOk = function(results) {
stopServer();
console.log(results);
console.log(JSON.stringify(results, null, 4));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 -> 2. 😝

types/types.ts Outdated
4: number; // PSI timing
5: number; // VISUALLY_COMPLETE timing
6: number; // TTFI timing
7: number; // TTCI timing
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since these are changing position, i guess these sheets will be a bit broken now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch 👍

TTFCP: 'first-contentful-paint',
TTFMP: 'first-meaningful-paint',
TTF_CPU_IDLE: 'first-cpu-idle',
TTCI: 'interactive',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TTI

export default {
TTFCP: 'first-contentful-paint',
TTFMP: 'first-meaningful-paint',
TTF_CPU_IDLE: 'first-cpu-idle',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TTFCPUIDLE ? :)

TTFMP: 'first-meaningful-paint',
TTF_CPU_IDLE: 'first-cpu-idle',
TTCI: 'interactive',
PSI: 'speed-index',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PSI -> SI everywhere. we ditched perceptual speed index and now just calculate speed index.

@denar90
Copy link
Collaborator Author

denar90 commented Aug 27, 2018

Finally CI passes 🎉
So waiting for LH to be updated with removing vscode-chrome-debug-core.
Other than that if we are ok to go without vizComplete metric I'll do final manual check and ready to 🚢 P.S. I still don't know what version it will be. Looks like v4...

@denar90
Copy link
Collaborator Author

denar90 commented Sep 7, 2018

@paulirish we are ready, I think)

@denar90
Copy link
Collaborator Author

denar90 commented Sep 12, 2018

I'm going to merge it at the and of the day today. In case of issues/comments, we can fix them in separate PR.

@paulirish
Copy link
Owner

paulirish commented Sep 12, 2018 via email

@denar90 denar90 merged commit ea85988 into master Sep 12, 2018
@denar90
Copy link
Collaborator Author

denar90 commented Sep 12, 2018

Merged 🎉

@denar90
Copy link
Collaborator Author

denar90 commented Sep 12, 2018

Still wondering about version,
3.4.0 or 4.0.0 wdyt?

@denar90 denar90 mentioned this pull request Sep 12, 2018
@paulirish
Copy link
Owner

i'd say stick to semver

so only bump major if you have a breaking change.

but since pwmetrics is using simulated throttling instead of devtools (right?), then the metrics numbers aren't really comparable. that'd be a breaking change. :)

so 4.0! :)

@denar90
Copy link
Collaborator Author

denar90 commented Sep 12, 2018

but since pwmetrics is using simulated throttling instead of devtools (right?), then the metrics numbers aren't really comparable. that'd be a breaking change. :)

yup. thanks)

@denar90 denar90 deleted the lh-v3-update branch September 12, 2018 21:31
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

Successfully merging this pull request may close these issues.

2 participants