Skip to content

Commit

Permalink
core(network-requests): include starting timestamp as debug data (#14253
Browse files Browse the repository at this point in the history
)
  • Loading branch information
brendankenny committed Aug 2, 2022
1 parent bbfeaf1 commit 3cfa258
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
8 changes: 8 additions & 0 deletions lighthouse-core/audits/network-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ class NetworkRequests extends Audit {

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

// Include starting timestamp to allow syncing requests with navStart/metric timestamps.
const networkStartTimeTs = Number.isFinite(earliestStartTime) ?
earliestStartTime * 1_000_000 : undefined;
tableDetails.debugData = {
type: 'debugdata',
networkStartTimeTs,
};

return {
score: 1,
details: tableDetails,
Expand Down
5 changes: 5 additions & 0 deletions lighthouse-core/test/audits/network-requests-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ describe('Network requests audit', () => {
mimeType: 'application/javascript',
resourceType: 'Script',
});

expect(output.details.debugData).toStrictEqual({
type: 'debugdata',
networkStartTimeTs: 360725781425,
});
});

it('should handle times correctly', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,11 @@
"resourceType": "Other",
"experimentalFromMainFrame": true
}
]
],
"debugData": {
"type": "debugdata",
"networkStartTimeTs": 28621648277
}
}
},
"network-rtt": {
Expand Down Expand Up @@ -8377,7 +8381,11 @@
"mimeType": "image/jpeg",
"resourceType": "Image"
}
]
],
"debugData": {
"type": "debugdata",
"networkStartTimeTs": 28632353955
}
}
},
"network-rtt": {
Expand Down Expand Up @@ -16906,7 +16914,11 @@
"resourceType": "Script",
"experimentalFromMainFrame": true
}
]
],
"debugData": {
"type": "debugdata",
"networkStartTimeTs": 28653584680
}
}
},
"network-rtt": {
Expand Down
6 changes: 5 additions & 1 deletion lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,11 @@
"resourceType": "Other",
"experimentalFromMainFrame": true
}
]
],
"debugData": {
"type": "debugdata",
"networkStartTimeTs": 8696703416
}
}
},
"network-rtt": {
Expand Down

0 comments on commit 3cfa258

Please sign in to comment.