-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(config): switch to lantern by default, add presets #5041
Conversation
lighthouse-cli/bin.js
Outdated
config = mixedContentConfig; | ||
// The mixed-content audits require headless Chrome (https://crbug.com/764505). | ||
cliFlags.chromeFlags = `${cliFlags.chromeFlags} --headless`; | ||
} else if (cliFlags.configPreset) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about just --preset
:D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wfm, @brendankenny ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--preset
yeah, I think it reads well in context
@@ -6,7 +6,7 @@ | |||
'use strict'; | |||
|
|||
module.exports = { | |||
extends: 'lighthouse:default', | |||
extends: 'lighthouse:observed', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the "observed" name refers to observed things (metrics, etc), regardless of throttling method.
Since this config is primarily about changing throttling method I would have expected a name like 'throttled'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started out with devtools
as the name but the primary value of this thing existing is having the 5s+ wait times in the defaultPass which applies to all observed methods. It does indeed change the throttlingMethod as well, but that's easily done without presets/extension. throttled
overly communicates the value in changing the throttling IMO, i.e. why would I want --preset=throttled --throttlingMethod=off/provided
?
The most consistent might be to make observed
not actually apply the throttling by default, and require --throttlingMethod=devtools
but that seems to discourage throttling which isn't great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just think its confusing that observedMetrics all exist outside of the lighthouse:observed
config.
better question: when is observed used? for --preset=perf and for the ttci smoketest, right? why doesn't ttci smoke just use/extend perf config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree that observed
is a little confusing here. It does sound like it's fairly neutral, observed regardless of throttling method, but if I was told it affected the throttling method I would guess it was closer to none
, not using devtools throttling.
But it sounds like you may be rearranging things, so maybe I'll wait to comment further :)
@@ -187,7 +188,7 @@ function deepClone(json) { | |||
// injection of plugins. | |||
if (Array.isArray(json.passes)) { | |||
cloned.passes.forEach((pass, i) => { | |||
pass.gatherers = cloneArrayWithPluginSafety(json.passes[i].gatherers); | |||
pass.gatherers = cloneArrayWithPluginSafety(json.passes[i].gatherers || []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happened here? Don't we require at least an empty array in the passes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well IMO, we shouldn't and the new defaults for passes make sure it's at least an empty array, but that doesn't work with the cloning, I can revert if you feel strongly all passes should declare empty gatherers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I think that makes sense in the extending case, if I'm reading your response correctly. Can you make gatherers optional in the LH.Config.PassJson
side of things, then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍
@@ -6,7 +6,7 @@ | |||
'use strict'; | |||
|
|||
module.exports = { | |||
extends: 'lighthouse:default', | |||
extends: 'lighthouse:observed', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree that observed
is a little confusing here. It does sound like it's fairly neutral, observed regardless of throttling method, but if I was told it affected the throttling method I would guess it was closer to none
, not using devtools throttling.
But it sounds like you may be rearranging things, so maybe I'll wait to comment further :)
OK ready for re-review I believe! no more observed config or extension, config.js just forces the defaultPass quiet thresholds to 5.25s+ if the throttling method is devtools or provided |
friendly ping here, review please! :) |
lighthouse-core/config/config.js
Outdated
const defaultPass = config.passes.find(pass => pass.passName === 'defaultPass'); | ||
if (!defaultPass) return; | ||
|
||
defaultPass.pauseAfterLoadMs = Math.max(5250, defaultPass.pauseAfterLoadMs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feels like this 5250 magic number should be defined in constants.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call done
@@ -60,7 +60,7 @@ | |||
"changelog": "conventional-changelog --config ./build/changelog-generator/index.js --infile changelog.md --same-file", | |||
"type-check": "tsc -p .", | |||
"update:sample-artifacts": "node lighthouse-core/scripts/update-report-fixtures.js -G", | |||
"update:sample-json": "node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --output=json --output-path=./lighthouse-core/test/results/sample_v2.json http://localhost/dobetterweb/dbw_tester.html && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing", | |||
"update:sample-json": "node ./lighthouse-cli -A=./lighthouse-core/test/results/artifacts --throttling-method=devtools --output=json --output-path=./lighthouse-core/test/results/sample_v2.json http://localhost/dobetterweb/dbw_tester.html && node lighthouse-core/scripts/cleanup-LHR-for-diff.js ./lighthouse-core/test/results/sample_v2.json --only-remove-timing", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doing this to avoid the mixed settings error, right?
next run of update-report-fixtures will be throttling-method: 'simulate', right?
so a followup PR to update both makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but speaking of. perhaps we should also have 1 golden LHR for simulate and 1 for throttled. Feels like we have a blind spot otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also left the golden LHR diffing on observed for now to reduce the noise, seems like we'll want to be checking both in our tests anyhow once there's 100% parity?
totally agree ;)
if everyone is afraid of this one we should get it in sooner rather than later to iron out the kinks ;) |
@@ -63,7 +63,7 @@ const SMOKETESTS = [{ | |||
id: 'offline', | |||
expectations: 'offline-local/offline-expectations.js', | |||
config: smokehouseDir + 'offline-config.js', | |||
batch: 'parallel-second', | |||
batch: 'offline', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paulirish I made this change after too many flakes on travis, now that things aren't throttled it seems too much is trying to happen at once and at least one navstart was getting dropped on ~70% of runs :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aiight.
@@ -63,7 +63,7 @@ const SMOKETESTS = [{ | |||
id: 'offline', | |||
expectations: 'offline-local/offline-expectations.js', | |||
config: smokehouseDir + 'offline-config.js', | |||
batch: 'parallel-second', | |||
batch: 'offline', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aiight.
lighthouse-core/config/constants.js
Outdated
@@ -60,8 +60,15 @@ const defaultPassConfig = { | |||
gatherers: [], | |||
}; | |||
|
|||
const observedPassConfigOverrides = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throttledPassConfigDefaults
or
nonSimulatedPassConfigOverrides
lighthouse-core/config/config.js
Outdated
if (!defaultPass) return; | ||
|
||
const overrides = constants.observedPassConfigOverrides; | ||
defaultPass.pauseAfterLoadMs = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wouldn't yell bloody murder if you renamed this to dPass
or something to avoid all the wrapppppppppppppppping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh, yeah I spent more time than I should to save this one, basically nothing saves the last one (triple networkQuietThresholdMs
is just too much` so I gave up, at least here it's consistent and easy to understand
🍫 😋 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a few things, otherwise looking good!
@@ -187,7 +188,7 @@ function deepClone(json) { | |||
// injection of plugins. | |||
if (Array.isArray(json.passes)) { | |||
cloned.passes.forEach((pass, i) => { | |||
pass.gatherers = cloneArrayWithPluginSafety(json.passes[i].gatherers); | |||
pass.gatherers = cloneArrayWithPluginSafety(json.passes[i].gatherers || []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I think that makes sense in the extending case, if I'm reading your response correctly. Can you make gatherers optional in the LH.Config.PassJson
side of things, then?
return; | ||
} | ||
|
||
const defaultPass = config.passes.find(pass => pass.passName === 'defaultPass'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hopefully in the future we can make a way to tell if it's a metric-measuring pass (similar to gather-runner's hacky isPerfRun
) rather than just the default pass, but not sure how to solve the problem if you want to do metric-measuring and have your own thresholds here that are less than the defaults...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that makes sense, I suppose we could do it on all useThrottling
passes as a proxy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed offline, it's an impl detail of TTI that we need 5s+ which is hardcoded to defaultPass
so we're sticking to defaultPass for now 👍
@@ -28,7 +28,8 @@ trap teardown EXIT | |||
|
|||
colorText "Generating a fresh LHR..." "$purple" | |||
set -x | |||
node "$lhroot_path/lighthouse-cli" -A="$lhroot_path/lighthouse-core/test/results/artifacts" --quiet --output=json --output-path="$freshLHRPath" http://localhost/dobetterweb/dbw_tester.html | |||
# TODO(phulce): add a lantern LHR-differ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should do this soon
@@ -58,7 +58,6 @@ Configuration: | |||
CHROME_PATH: Explicit path of intended Chrome binary. If set must point to an executable of a build of | |||
Chromium version 54.0 or later. By default, any detected Chrome Canary or Chrome (stable) will be launched. | |||
[default: ""] | |||
--perf Use a performance-test-only configuration [boolean] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need presets and other new changes here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -22,7 +21,7 @@ const log = require('lighthouse-logger'); | |||
window.runLighthouseForConnection = function( | |||
connection, url, options, categoryIDs, | |||
updateBadgeFn = function() { }) { | |||
const config = options && options.fastMode ? new Config(fastConfig, options.flags) : new Config({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where was this set before? I can't find it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's just set by lightrider, all runs for them will be simulated now anyway
}); | ||
|
||
assert.equal(config.settings.throttlingMethod, 'devtools'); | ||
assert.ok(config.passes[0].pauseAfterLoadMs >= 5000, 'did not adjust load quiet ms'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add assertion that this is defaultPass
? And maybe a test (or modify this test) with more categories so it can check other passes aren't affected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@brendankenny LGTY? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Changes
'simulate'
--perf
and--mixed-content
with--preset=perf/mixed-content
, there's been some opposition to this before, it wouldn't be incredibly laborious to keep so lmk--throttling-method=devtools
Yet to Change
The perfy smoke tests made some assumptions about the network/CPU quiet thresholds that don't hold up anymore, so left those testing the devtools path for now and will update those as I finish up the opportunity parity, on the plus side rest of smoketest time went from ~100s to ~80s :)
Also left the golden LHR diffing on observed for now to reduce the noise, seems like we'll want to be checking both in our tests anyhow once there's 100% parity?