-
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: add DevtoolsLogError
and TraceError
artifacts
#15311
Conversation
@@ -367,6 +367,8 @@ class Runner { | |||
|
|||
let auditResult; | |||
try { | |||
if (artifacts.PageLoadError) throw artifacts.PageLoadError; | |||
|
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'm unsure about this change.
My understanding from discussing this earlier was that the most non-breaking / simple change here would be for L380 conditional to include artifacts.PageLoadError
, to keep the behavior of "don't run any audits if we can't trust the trace/logs to be good".
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.
"don't run any audits if we can't trust the trace/logs to be good"
That's what this behavior is. We throw an error early if we can't trust the DT log or trace (i.e. there was a page load error).
If we added artifacts.PageLoadError
to the conditional on L380 we would always be throwing a missing artifact error for whichever artifact happened to be first in the list. So we are throwing an error in both situations, the difference is what the error message is. I think it makes more sense to surface the page load error rather than say "Missing required artifact devtoolsLogs" especially when the devtools log is there.
The situation is definitely confusing in both situations, so I won't die on this hill. We could also consider one of the alternatives.
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.
for whichever artifact happened to be first in the list
Ah, my actual working suggestion would have to be adding to L376/377, then.
Does throwing the artifact PageLoadError here have desired results? as in, now instead of throwing a MISSING_REQUIRED_ARTIFACT
error, we'd get the page load error instead in some cases.
Also, when would this actually occur - do we not throw on a page load error earlier than this function?
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.
Does throwing the artifact PageLoadError here have desired results? as in, now instead of throwing a MISSING_REQUIRED_ARTIFACT error, we'd get the page load error instead in some cases.
Yeah https://googlechrome.github.io/lighthouse/viewer/?gist=765026ff99e2f51e1e5b82675e26ef46
Also, when would this actually occur - do we not throw on a page load error earlier than this function?
We will always surface the page load error before mentioning any missing artifacts now. We still might have a missing artifact error if we did lighthouse -A
on some bad artifact data or something.
We don't throw on a page load error but it is listed as a top level warning.
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 don't throw on a page load error but it is listed as a top level warning.
Yes, see the discussion at #8865 (comment) linked from #9236
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.
My only concern here is the code we would run in catch
for every single audit in this case.
Can we instead pull this up into where Runner._runAudit
is called - if PageLoadError is present, we construct the err'd audit results at that level? This would skip us reporting to Sentry or logging a warning for each audit.
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 could be a good idea, the sentry logging is completely unnecessary, but FWIW this is unchanged from current behavior, it's just using the PageLoadError instead of a MISSING_REQUIRED_ARTIFACT
error per audit.
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.
Agreed it's same behavior as today - let's do in a second PR since this one is big enough already.
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.
Second PR sounds good
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 seems reasonable. As I recall the primary reason for keeping the artifacts.traces.pageLoadError-whatever
was for debugging with -A
in the rare cases where somehow you ended up with a page load error and you didn't know how. Is there any other use of them? Having the devtoolslog/trace under their normal names makes it slightly more likely they could be mistakenly used when there was a pageLoadError, but I don't think we want to get rid of the -A
use case.
It kinda contradicts the goals of #9236 though but using the page load error as the audit error message makes more sense than saying "Traces gatherer did not run" IMO.
I think this solution feels well within the intention of what #9236 was fixing (the changed error message was just a side effect, and this is arguably an improvement on those).
@@ -367,6 +367,8 @@ class Runner { | |||
|
|||
let auditResult; | |||
try { | |||
if (artifacts.PageLoadError) throw artifacts.PageLoadError; |
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.
Looking at the smoke test as examples, maybe this should throw a simple new LH error rather than repeating the page load error a million times? The metric section in particular could end up pretty gnarly with the longer network errors.
The top-level pageLoadError would be the main explanation, the individual audit errors can simply say they were unable to run due to a page load error or whatever?
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.
Not an outrageous idea, although I think repeating the same error message everywhere has benefits.
I've responded to a few bugs where users ask about the "traces gatherer did not run" error message but completely miss the more detailed top level run warning that explains the problem better. I believe users (myself included sometimes) skip over the warning section and go straight to the giant wall of red text for the failure information.
If we have a generic "Page load failed error" I think we're missing an opportunity to explain the error in the first place the user's attention in drawn to.
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 we have a generic "Page load failed error"
The message could be "An error during page load prevented this audit from running. See the error message given at the top of the report" or something.
with the longer network errors.
How long are we talking here? 10x/100x than what I just wrote above?
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.
The message could be "An error during page load prevented this audit from running. See the error message given at the top of the report" or something.
Yeah but from a JSON consumer perspective this makes less sense.
How long are we talking here? 10x/100x than what I just wrote above?
It vary depending on what error details are provided. FWIW the error will be in a tooltip most of the time. If we're really worried about blowing up the metric section though, I would prefer to elide the displayed text rather than choose a more indirect albeit shorter error message.
@@ -367,6 +367,8 @@ class Runner { | |||
|
|||
let auditResult; | |||
try { | |||
if (artifacts.PageLoadError) throw artifacts.PageLoadError; | |||
|
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 don't throw on a page load error but it is listed as a top level warning.
Yes, see the discussion at #8865 (comment) linked from #9236
This plus teaching asset-saver to save these (with some kind of error-ful name) seems like a good solution too. Cover the current use cases and ensure no code would accidentally use a trace or devtoolslog without handling the pageLoadError case. |
DevtoolsLogError
and TraceError
artifacts
#15306
Before: https://googlechrome.github.io/lighthouse/viewer/?gist=1c712c30d8e871163cadb014df6125c8
After: https://googlechrome.github.io/lighthouse/viewer/?gist=765026ff99e2f51e1e5b82675e26ef46
If there was a page load error in navigation mode, we still hold on to the DT log and trace for debugging purposes. This currently requires us to use the
devtoolsLogs
/traces
compat artifacts because we assign them a different "pass name" for being errors (i.e.pageLoadError-default
instead ofdefaultPass
).This PR will hold onto the DT log and trace in the defaultThis PR also throws an error for all audits if it detects a page load error so we are still not running these audits.artifacts.DevtoolsLog
andartifacts.Trace
locations. This means that audits which used to throw for a missing DT log or trace could now produce a valid result if we ran them.It kinda contradicts the goals of #9236 though but using the page load error as the audit error message makes more sense than saying "Traces gatherer did not run" IMO.
Some alternatives include:
artifacts.DevtoolsLogError
andartifacts.TraceError
to keep erroneous DT logs/traces separate from regular ones in the new artifacts structurecore/runner.js
)