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

fix: better debug message for missing network times #2451

Merged
merged 5 commits into from
Jun 7, 2017

Conversation

patrickhulce
Copy link
Collaborator

Improves the debug information when network throughput can't be computed and defaults the result to Infinity instead of 0 which makes more sense since the only use of networkThroughput is to be the divisor (the computed artifact is also used by total byte weight which makes sense to say 0 ms time and still report the byte savings)

This was affecting chrome URLs which don't have any timing information, results from before and after for chrome://version below (the optimized images error is for tainting canvas which apparently all chrome images do)

Before
image

After
image

Copy link
Member

@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.

awesome stuff.

@@ -38,6 +36,10 @@ class NetworkThroughput extends ComputedArtifact {
return boundaries;
}, []).sort((a, b) => a.time - b.time);

if (!timeBoundaries.length) {
Copy link
Member

Choose a reason for hiding this comment

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

can you document this in the jsdoc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -193,6 +193,12 @@ class CategoryRenderer {
const descriptionEl = this._dom.createChildOf(element, 'div', 'lh-perf-hint__description');
descriptionEl.appendChild(this._dom.convertMarkdownLinkSnippets(audit.result.helpText));

if (audit.result.debugString) {
Copy link
Member

Choose a reason for hiding this comment

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

what is this adding that wasn't there before? Not clear from the screenshot

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it was, but not if it didn't completely fail (this was sort of drive by, there are other debugStrings that can be set)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added a test now for it

Copy link
Member

Choose a reason for hiding this comment

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

it was, but not if it didn't completely fail

it was...what? :P

@@ -85,7 +85,7 @@ describe('Byte efficiency base audit', () => {
{wastedBytes: 450, totalBytes: 1000, wastedPercent: 50},
{wastedBytes: 400, totalBytes: 450, wastedPercent: 50},
],
});
}, 1000);
Copy link
Member

Choose a reason for hiding this comment

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

need new tests, too

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

a new test in network-throughput-test.js to replicate what was coming in from chrome:// URLs would be good too, but otherwise LGTM

@patrickhulce
Copy link
Collaborator Author

a new test in network-throughput-test.js to replicate what was coming in from chrome:// URLs would be good too, but otherwise LGTM

done

@brendankenny
Copy link
Member

travis is greeeeeen

@brendankenny brendankenny merged commit 3dda036 into master Jun 7, 2017
@brendankenny brendankenny deleted the network_throughput_error branch June 7, 2017 05:57
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.

None yet

3 participants