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-request): switch to improved timing names #14721

Merged
merged 5 commits into from
Feb 1, 2023
Merged

Conversation

brendankenny
Copy link
Member

Alternative to #14574 doing only renames, no functional changes:

  • s/startTime/networkRequestTime/g
  • s/endTime/networkEndTime/g
  • s/responseReceivedTime/responseHeadersEndTime/g

This avoids the need for getters in network-request and the support for both new and old property names in network-records-to-devtools-log.

It also doesn't add rendererEndTime. That could still be done in a follow up, but since it wouldn't do anything different than networkEndTime for now, maybe it's better as an issue?

Also required:

  • Minimal fix to CriticalRequestChains
    I don't think we want to change the audit details because that would require a prepareReportResult section to convert existing CRC details, and it seems probable we'll come up with new critical path audits and ditch the old CRC stuff before too long :)
  • A few max-length lint fixes due to the longer property names

Need to commit with Co-authored-by: Connor Clark <cjamcl@gmail.com> since @connorjclark did all the very lengthy work dealing with all our bikeshedding of the names :)

@brendankenny brendankenny requested a review from a team as a code owner January 27, 2023 00:58
@brendankenny brendankenny requested review from connorjclark and removed request for a team January 27, 2023 00:58
@@ -41,42 +41,42 @@ class CriticalRequestChains extends Audit {
};
}

/** @typedef {{depth: number, id: string, chainDuration: number, chainTransferSize: number, node: LH.Audit.Details.SimpleCriticalRequestNode[string]}} CrcNodeInfo */
/** @typedef {{depth: number, id: string, chainDuration: number, chainTransferSize: number, node: LH.Artifacts.CriticalRequestNode[string]}} CrcNodeInfo */
Copy link
Member Author

@brendankenny brendankenny Jan 27, 2023

Choose a reason for hiding this comment

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

This file has the only real changes. This was actually always LH.Artifacts.CriticalRequestNode because the input was the (computed) artifact, with node.request being an actual NetworkRequest, but previous to this PR that was actually structurally compatible with the simplified LH.Audit.Details.SimpleCriticalRequestNode:

type SimpleCriticalRequestNode = {
[id: string]: {
request: {
url: string;
startTime: number;
endTime: number;
responseReceivedTime: number;
transferSize: number;
};
children?: SimpleCriticalRequestNode;
}

so the two types could be used interchangeably.

Since we don't want to change LH.Audit.Details.SimpleCriticalRequestNode, but node.request now has networkRequestTime, etc on it, this file needs to now actually differentiate between the two, and there needs to be a copy step from the new property names to the old property names on the audit details.

Nothing actually changes in the output (see sample_v2.json for an example).

@@ -199,7 +199,7 @@ class CriticalRequestChains extends Audit {
walk(initialNavChildren, 0);
}

const longestChain = CriticalRequestChains._getLongestChain(flattenedChains);
const longestChain = CriticalRequestChains._getLongestChain(chains);
Copy link
Member Author

Choose a reason for hiding this comment

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

AFAICT this never made sense to run on flattenedChains, since it recomputes the durations anyways, but it previously worked either way. Now it just needs to drop the * 1000 since request times are in milliseconds after #14567

Comment on lines +98 to +99
const timeSinceMainEnd = Math.max(0, record.networkRequestTime - mainResource.networkEndTime);
return timeSinceMainEnd < PRECONNECT_SOCKET_MAX_IDLE_IN_MS;
Copy link
Member Author

Choose a reason for hiding this comment

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

the only other real code change, because it was kind of hard to read split over two lines. An intermediate variable seemed fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants