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(network): handle LR transferSize #5895

Merged
merged 2 commits into from
Aug 23, 2018
Merged

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Aug 22, 2018

Summary
In LR's case we don't have real transfer size, we just have the header of original content length. I went with the isLightRider global var for a few reasons.

  1. It's the clearest way to ensure this hack does not ever impact our other channels.
  2. It's a convenient way to track progress through the life of a network request (transferSize is updated multiple places and we need to reset this a couple times.
  3. I have a feeling this won't be the last time LR has some subtle difference that needs to be accounted for.

sizes now look good with the traces/devtoolslog paul provided
image

Related Issues/PRs
fixes #5839


declare module NodeJS {
interface Global {
isLightRider?: boolean;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@brendankenny on a scale of 1-5, how offensive is this to you?

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.

Wfm

if (!originalContentLength) return;

// Transfer size is the original content length + length of headers
const contentBytes = parseFloat(originalContentLength.value);
Copy link
Member

Choose a reason for hiding this comment

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

I am tickled. :)

*/
_updateTransferSizeForLightRiderIfNecessary() {
// Bail if we're not in LightRider, this only applies there.
if (!global.isLightRider) return;
Copy link
Member

Choose a reason for hiding this comment

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

I figure this is the best global reference we got.. better than self? WFM

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 was just using what we decided to go with in web-inspector.js last time

@@ -95,6 +95,9 @@ async function runLighthouseInExtension(flags, categoryIDs) {
* @return {Promise<string|Array<string>|void>}
*/
async function runLighthouseInLR(connection, url, flags, {lrDevice, categoryIDs, logAssets}) {
// Certain fixes need to kick-in under LR, see https://github.com/GoogleChrome/lighthouse/issues/5839
Copy link
Member

Choose a reason for hiding this comment

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

One if the origin RTT estimates only applies in LR. Do you want to re use this there? Fine if you don't.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nah that's ok that fallback is a lot more sound than this one :)

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.

on a scale of 1-5, how offensive is this to you?

ha, well I medium hate it. Not sure of the numeric value of that.

I'm pretty ok with it since it's pretty much constant from the start of the run and so doesn't cause weird non-local effects that are difficult to trace through the codebase. Buuuuuut, looking at #4972 again, if we're going to be piping the channel around for that anyways (through process.env.LH_CHANNEL or in flags or whatever), I wonder if we should just piggy back on that.

It is a pain to get settings down into NetworkRequest, though. Seems like the NetworkRecords computed artifact would need a whole computed artifact re-architecture, so maybe something global is inevitable...

@patrickhulce
Copy link
Collaborator Author

medium hate it

sounds good enough to me :)

Seems like the NetworkRecords computed artifact would need a whole computed artifact re-architecture, so maybe something global is inevitable...

Yeah this is what I was thinking as well, I did not like the mental chain of what would need to accept context

@patrickhulce patrickhulce merged commit bb363ff into master Aug 23, 2018
@patrickhulce patrickhulce deleted the handle_no_transfer_size branch August 23, 2018 21: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.

LR vs CLI differences between Perf opps/diags
3 participants