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

core(diagnostics): add diagnostic audits #7052

Merged
merged 9 commits into from
Feb 4, 2019
Merged

core(diagnostics): add diagnostic audits #7052

merged 9 commits into from
Feb 4, 2019

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Jan 17, 2019

Summary
Collect page vital stats into a single audit. Also adds two new user-facing audits for server latency by origin and RTT by origin.

Related Issues/PRs
#6775

@benschwarz
Copy link
Contributor

These are going to be hugely valuable! Great work so far @patrickhulce

Copy link
Member

@exterkamp exterkamp left a comment

Choose a reason for hiding this comment

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

Audits LGTM, not sure about the scoring of the audits, but since they are informational I guess it doesn't matter?

Mostly nits about the UIStrings and diagnostic suggestions.

return {
score: 1,
rawValue: 1,
details: {items: [diagnostics]},
Copy link
Member

Choose a reason for hiding this comment

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

Just a note probably for another PR, but this format is weird for informational audits. Can we make a new details format for just info? Like, just put the fields directly in details? Or if ts won't like that:

details: {
   ...
   information: {
      key: value,
      ...
   },
   ...
}

The array makes it weird 😦

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah agreed, it's the same as the metrics audit for now

numFonts: records.filter(r => r.resourceType === 'Font').length,
numTasks: toplevelTasks.length,
numTasksOver10ms: toplevelTasks.filter(t => t.duration > 10).length,
numTasksOver25ms: toplevelTasks.filter(t => t.duration > 25).length,
Copy link
Member

Choose a reason for hiding this comment

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

no numTasksOver50ms ? 😮

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

heh, I'll add it, for lantern I was treating numTasksOver10ms as the rough equivalent :)

const tasks = await MainThreadTasksComputed.request(trace, context);

const results = tasks
.filter(task => task.duration > 5)
Copy link
Member

Choose a reason for hiding this comment

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

this 5ms threshold should get mentioned in the description, probably?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sounds good

for (const [origin, additionalRtt] of analysis.additionalRttByOrigin.entries()) {
// TODO: https://github.com/GoogleChrome/lighthouse/issues/7041
if (!Number.isFinite(additionalRtt)) continue;
if (origin.startsWith('__')) continue;
Copy link
Member

Choose a reason for hiding this comment

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

who dat

Copy link
Collaborator Author

@patrickhulce patrickhulce Jan 18, 2019

Choose a reason for hiding this comment

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

there's a __SUMMARY__ entry in there that has the overall information, I'll flip it to only include http entries


const UIStrings = {
/** Descriptive title of a Lighthouse audit that tells the user the server latencies observed from each origin the page connected to. This is displayed in a list of audit titles that Lighthouse generates. */
title: 'Server Latencies',
Copy link
Member

Choose a reason for hiding this comment

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

Server Backend Latencies?

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

title: 'Server Latencies',
/** Description of a Lighthouse audit that tells the user that server latency can effect their website's performance negatively. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Server latencies can impact web performance. ' +
'If the server latency of an origin is high, it\'s an indication the server is overloaded ' +
Copy link
Member

Choose a reason for hiding this comment

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

I think this description should also indicate how the RTT is factored in. Are these values JUST the backend latency or the BL + RTT?

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's our best guess for "just the backend latency"

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'm not sure how to put this without unnecessarily confusing folks. I'm not confident that the number of people who will understand this subtlety is very high (or the people that will know what to do with this audit, honestly)

Copy link
Member

Choose a reason for hiding this comment

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

k. well given the updated title change i think it's good.

Copy link
Member

Choose a reason for hiding this comment

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

or the people that will know what to do with this audit, honestly

seems like the audit should always be hidden, then?

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.

Also adds two new user-facing audits for server latency by origin and RTT by origin.

can we split this out? I'm not sure why these are in this PR instead of their own :)

@patrickhulce
Copy link
Collaborator Author

can we split this out?

sure

I'm not sure why these are in this PR instead of their own :)

because those are also critical page vitals that I've been using to debug variance

@patrickhulce
Copy link
Collaborator Author

patrickhulce commented Jan 28, 2019

Can this get some priority when reviewing as folks come back from NY? :)

This is blocking my further efforts to expose variance, so I'd love to get it merged ASAP

@paulirish
Copy link
Member

Also adds two new user-facing audits for server latency by origin and RTT by origin.

Proposed compromise: keep these audits in the PR but don't expose as user-facing. That can be done in a followup.

@patrickhulce
Copy link
Collaborator Author

Proposed compromise: keep these audits in the PR but don't expose as user-facing. That can be done in a followup.

Deal!

@brendankenny
Copy link
Member

Proposed compromise: keep these audits in the PR but don't expose as user-facing.

lol, I was less concerned about the audits than the length of the PR (before tests). Do I need to forward "Small CLs" to everyone? :P

Smaller PRs get reviewed faster and take fewer rounds of review!

@exterkamp exterkamp dismissed their stale review January 30, 2019 19:15

old news

@patrickhulce
Copy link
Collaborator Author

So is the conclusion that we're going back to the version without those two audits?

I'm fine either way, but most recent attempt suggests the divide between L and XL does not help much in terms of eyeballs and I don't see a way of making this an XS/S with all our fixtures that get updated 😛

There's ~140 lines of substance, ~800 lines of fixtures, ~170 lines of strings/new audit boilerplate. Let me know how it'd be preferred to be divided for review.

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.

It does feel like we're coming to a decision point with putting diagnostics in the LHR. LHRs are approaching ~1MB in size again. main-thread-tasks doesn't end up too bad (2-6% on bad sites), but network-requests tends to be big (10-15% on bad sites, basically the same size as the thumbnails), all for data that is looked at a tiny fraction of the times LH is run.

At some point we should ask folks to just save artifacts, cause that's what they really want. Or maybe we make a --preset=diagnostic and add these audits or something.

Aside from that, everything here LGTM, but it all needs tests :S

title: 'Server Latencies',
/** Description of a Lighthouse audit that tells the user that server latency can effect their website's performance negatively. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Server latencies can impact web performance. ' +
'If the server latency of an origin is high, it\'s an indication the server is overloaded ' +
Copy link
Member

Choose a reason for hiding this comment

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

or the people that will know what to do with this audit, honestly

seems like the audit should always be hidden, then?

{id: 'network-rtt', weight: 0},
{id: 'network-server-latency', weight: 0},
{id: 'main-thread-tasks', weight: 0},
{id: 'diagnostics', weight: 0},
Copy link
Member

Choose a reason for hiding this comment

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

can we move these audits down to the bottom and add a comment? Kind of subtle that no group in the performance category means they're not visible :)

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

*/
'use strict';

const Audit = require('./audit');
Copy link
Member

Choose a reason for hiding this comment

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

.js

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

const results = [];
for (const [origin, additionalRtt] of analysis.additionalRttByOrigin.entries()) {
// TODO: https://github.com/GoogleChrome/lighthouse/issues/7041
if (!Number.isFinite(additionalRtt)) continue;
Copy link
Member

Choose a reason for hiding this comment

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

seems important to include these if using them for debugging/anomaly spotting?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good point, done

const tableDetails = Audit.makeTableDetails(headings, results);

return {
score: Math.max(1 - (maxLatency / 500), 0),
Copy link
Member

Choose a reason for hiding this comment

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

fwiw, if it's informative this gets nulled out

Copy link
Collaborator Author

@patrickhulce patrickhulce Jan 31, 2019

Choose a reason for hiding this comment

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

removed

I played around with it being scored, but that felt like it put too much emphasis on it

@@ -96,9 +96,21 @@ Object {
Object {
"path": "font-display",
},
Object {
Copy link
Member

Choose a reason for hiding this comment

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

needs to be updated

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

@patrickhulce
Copy link
Collaborator Author

It does feel like we're coming to a decision point with putting diagnostics in the LHR. LHRs are approaching ~1MB in size again.

Yeah, I agree. I also think we need to find a balance with being able to provide a bit more information when users are confused though. There's the extreme like #5844, but basic stats on the page seem like fair game for intermediate devs to understand.

I think there's value in having diagnostic information available in the report (even if it should be hidden a bit), so that a junior dev can call over to someone who knows a bit more and help them interpret something when things get trickier.

@patrickhulce
Copy link
Collaborator Author

bump

@patrickhulce
Copy link
Collaborator Author

🏏 🏏 🏏

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.

I somehow completely missed your push/bump last week and was still waiting for your update. Really sorry to make you wait on this.

@brendankenny brendankenny merged commit 4513546 into master Feb 4, 2019
@brendankenny brendankenny deleted the page_vitals branch February 4, 2019 19:34
patrickhulce added a commit that referenced this pull request Feb 4, 2019
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.

5 participants