-
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
Remove recordNetwork #2102
Remove recordNetwork #2102
Conversation
18902c6
to
f0481df
Compare
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.
https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/config/plots.json also has a stray recordNetwork
lighthouse-core/config/config.js
Outdated
const passName = pass.passName || Audit.DEFAULT_PASS; | ||
if (usedNames.has(passName)) { | ||
log.warn('config', `passes[${index}] may overwrite trace or network ` + | ||
`data of earlier pass without a unique passName (repeated name: ${passName}.`); | ||
log.warn('config', `passes[${index}] may overwrite trace ` + |
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.
may overwrite data
since it still could overwrite network records?
We should probably throw here instead of warning as there's no "may" about it anymore for network records. Can just be Passes must have unique names (repeated name: ${passName}).
or something?
lighthouse-core/config/config.js
Outdated
@@ -129,17 +129,13 @@ function validatePasses(passes, audits, rootPath) { | |||
}); | |||
}); | |||
|
|||
// Log if multiple passes require trace or network recording and could overwrite one another. | |||
// Passes should have unique passName's. Warn 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.
drop apostrophe
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 guess that's hard to differentiate in a comment :)
// Passes should have unique `passName`s. Warn otherwise.
?
// Passes should all have a unique passName. Warn otherwise.
?
|
||
// Network records only given to gatherers if requested by config. | ||
config.recordNetwork && (passData.networkRecords = networkRecords); | ||
// expose devtoolsLog & networkRecords to 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.
capital E
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.
there's also a // Network is always recorded for internal use, even if not saved as artifact.
comment that needs updating
// Network records only given to gatherers if requested by config. | ||
config.recordNetwork && (passData.networkRecords = networkRecords); | ||
// expose devtoolsLog & networkRecords to gatherers | ||
passData.devtoolsLog = driver.devtoolsLog; |
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.
this is already handled above in config.recordTrace
block
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 catch. devtoolsLog should never be within a recordTrace
conditional.
config.recordNetwork && | ||
(tracingData.networkRecords[passName] = passData.networkRecords); | ||
|
||
tracingData.devtoolsLogs[passName] = passData.devtoolsLog; |
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.
this has the same problem as #2062 in that there's no passData.devtoolLog
if there was no trace. Leave inside the conditional until that's fixed?
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.
fixing that in this PR now. :)
(tracingData.networkRecords[passName] = passData.networkRecords); | ||
|
||
tracingData.devtoolsLogs[passName] = passData.devtoolsLog; | ||
tracingData.networkRecords[passName] = passData.networkRecords; |
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.
// If requested by config
comment above needs update
test errors are from not all passes having names in smokehouse's pwa-config.js so network records are overwriting each other. So, probably 👍 to throw in config.js to catch that early |
bfc1e62
to
616a050
Compare
PTAL |
.then(_ => driver.beginNetworkCollect(options)) | ||
.then(_ => driver.beginDevtoolsLog()) |
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.
nit: should we do this the other way around? feasibly there could be some network request recorded before the devtools log start I guess, idk
love it |
@brendankenny this work for you? |
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 have a proposal for simplifying things a bit more. I'll make a PR on top of this :)
lighthouse-core/config/config.js
Outdated
const passName = pass.passName || Audit.DEFAULT_PASS; | ||
if (usedNames.has(passName)) { | ||
log.warn('config', `passes[${index}] may overwrite trace or network ` + | ||
`data of earlier pass without a unique passName (repeated name: ${passName}.`); | ||
throw new Error(`Passes must have unique names (repeated passName: ${passName}.`); |
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.
hmm, this will still be confusing when a config doesn't include any pass names ("(repeated passName: defaultPass."
). I don't know if there's a super clean solution (like the use of a Set
here) if we want to still support one unnamed pass defaulting to defaultPass
.
We could drop that, though, since it's a little confusing with the new world of always recording devtoolsLog, and this check could have two checked errors: no pass name and repeated pass names.
lighthouse-core/gather/driver.js
Outdated
} | ||
|
||
endDevtoolsLog() { | ||
this._devtoolsLog.endRecording(); |
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.
should this return the log like endTrace
and endNetworkCollect
instead of having GatherRunner call the getter directly?
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.
And actually, should it return a promise? Kind of silly to wrap in yet another promise (less silly when we get async/await tho), but I was noticing the other day that endNetworkCollect
is also wrapped in a promise despite being sync...presumably to keep the API easy to reason about.
Just bringing up the idea, not sure how I feel about that :)
.then(_ => driver.beginNetworkCollect(options)) | ||
.then(_ => driver.beginDevtoolsLog()) |
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 to update outline at top of file
@@ -238,20 +239,20 @@ class GatherRunner { | |||
// an object with a traceEvents property. Normalize to object form. | |||
passData.trace = Array.isArray(traceContents) ? | |||
{traceEvents: traceContents} : traceContents; | |||
passData.devtoolsLog = driver.devtoolsLog; | |||
log.verbose('statusEnd', 'Retrieving trace'); | |||
}); | |||
} | |||
|
|||
const status = 'Retrieving network records'; |
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.
update status message?
actually, no I won't :) I really need #2062 to do it cleanly. Speaking of which, what do you think about reverting the last commit? It should really be in #2062 anyways...this PR can get by pretty easily without touching devtoolsLog and #2062 is already touching it, so it makes a lot more sense over there |
(or just merge them together or whatever if this is getting crazy since they're both mostly reviewed) |
OK, removed |
yup. this WFM. |
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.
waiting for travis...
* always record network and save in artifacts
Now, we always actually record it. (And it's separated from
recordTrace
)This flag was differentiating on if we expose it to gatherers and artifacts objects.