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(tti): update ignorable network requests and start point #5021

Merged
merged 3 commits into from
Apr 25, 2018

Conversation

patrickhulce
Copy link
Collaborator

updates TTI definition based on v1.0 in the doc

  • use FCP instead of FMP
  • ignore non-GET network requests
  • ignore failed/unfinished network requests

NOTE: this PR does not tweak our decision of when to stop tracing, just the computation for observed TTI

ref #4629 #5008 #4333

@@ -28,8 +33,11 @@ class ConsistentlyInteractive extends MetricArtifact {
*/
static _findNetworkQuietPeriods(networkRecords, traceOfTab) {
const traceEndTsInMs = traceOfTab.timestamps.traceEnd / 1000;
/** @param {LH.WebInspector.NetworkRequest} record */
Copy link
Member

Choose a reason for hiding this comment

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

a comment for the filter would be good here, even though it's in the linked doc

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

@@ -28,8 +33,11 @@ class ConsistentlyInteractive extends MetricArtifact {
*/
static _findNetworkQuietPeriods(networkRecords, traceOfTab) {
const traceEndTsInMs = traceOfTab.timestamps.traceEnd / 1000;
/** @param {LH.WebInspector.NetworkRequest} record */
const filter = record => record.finished && record.requestMethod === 'GET' && !record.failed &&
Math.floor(record.statusCode / 100) < 4;
Copy link
Member

Choose a reason for hiding this comment

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

whaaaa

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 comment 😆

@@ -97,7 +97,7 @@ const ERRORS = {

Object.keys(ERRORS).forEach(code => ERRORS[code].code = code);

/** @type {Object<string, LighthouseErrorDefinition>} */
/** @type {Object<keyof ERRORS, LighthouseErrorDefinition>} */
Copy link
Member

Choose a reason for hiding this comment

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

👍

return NetworkRecorder.findNetworkQuietPeriods(networkRecords,
ALLOWED_CONCURRENT_REQUESTS, traceEndTsInMs);
ALLOWED_CONCURRENT_REQUESTS, traceEndTsInMs, filter);
Copy link
Member

Choose a reason for hiding this comment

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

making NetworkRecorder.findNetworkQuietPeriods polymorphic like this makes me nervous since we use it for monitoring network quiet during page load. In CLI usage it's no big deal since this always happens after gathering is finished, but wdyt about avoiding the question altogether and filter before passing in?

Copy link
Member

Choose a reason for hiding this comment

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

filtering before we passing networkrecords seems reasonable.

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 sg, changed to filter in TTI

@@ -28,8 +33,11 @@ class ConsistentlyInteractive extends MetricArtifact {
*/
static _findNetworkQuietPeriods(networkRecords, traceOfTab) {
const traceEndTsInMs = traceOfTab.timestamps.traceEnd / 1000;
/** @param {LH.WebInspector.NetworkRequest} record */
const filter = record => record.finished && record.requestMethod === 'GET' && !record.failed &&
Copy link
Member

Choose a reason for hiding this comment

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

descriptiveName?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

don't need it anymore

return NetworkRecorder.findNetworkQuietPeriods(networkRecords,
ALLOWED_CONCURRENT_REQUESTS, traceEndTsInMs);
ALLOWED_CONCURRENT_REQUESTS, traceEndTsInMs, filter);
Copy link
Member

Choose a reason for hiding this comment

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

filtering before we passing networkrecords seems reasonable.

@@ -79,11 +87,11 @@ class ConsistentlyInteractive extends MetricArtifact {
* @return {{cpuQuietPeriod: TimePeriod, networkQuietPeriod: TimePeriod, cpuQuietPeriods: Array<TimePeriod>, networkQuietPeriods: Array<TimePeriod>}}
*/
static findOverlappingQuietPeriods(longTasks, networkRecords, traceOfTab) {
const FMPTsInMs = traceOfTab.timestamps.firstMeaningfulPaint / 1000;
const FCPTsInMs = traceOfTab.timestamps.firstContentfulPaint / 1000;
Copy link
Member

Choose a reason for hiding this comment

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

FcpTsInMs 🤣

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

😝

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.

LGTM

@patrickhulce patrickhulce merged commit 1957cae into master Apr 25, 2018
@patrickhulce patrickhulce deleted the tti_tweaks branch April 25, 2018 20:02
@paulirish paulirish mentioned this pull request Apr 25, 2018
82 tasks
kdzwinel pushed a commit to kdzwinel/lighthouse that referenced this pull request Aug 16, 2018
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.

4 participants