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

misc(proto): add throttling and throttling_method #13309

Merged
merged 8 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions lighthouse-core/lib/proto-preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,22 @@ function processForProto(lhr) {
// 'ignore unknown fields' in the language of conversion.
if (reportJson.configSettings) {
// The settings that are in both proto and LHR
const {formFactor, locale, onlyCategories, channel} = reportJson.configSettings;
const {
formFactor,
locale,
onlyCategories,
channel,
throttling,
throttlingMethod} = reportJson.configSettings;

// @ts-expect-error - intentionally only a subset of settings.
reportJson.configSettings = {formFactor, locale, onlyCategories, channel};
reportJson.configSettings = {
formFactor,
locale,
onlyCategories,
channel,
throttling,
throttlingMethod};
}

// Remove runtimeError if it is NO_ERROR
Expand Down
29 changes: 28 additions & 1 deletion proto/lighthouse-result.proto
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ message LighthouseResult {
map<string, CategoryGroup> category_groups = 11;

// Message containing the configuration settings for the LH run
// Next field number: 6
// Next ID: 9
message ConfigSettings {
// The possible form factors an audit can be run in.
// This enum served the emulated_form_factor field, but in v7, that field
Expand Down Expand Up @@ -158,6 +158,33 @@ message LighthouseResult {
// How Lighthouse was run, e.g. from the Chrome extension or from the npm
// module
string channel = 4;

// Next ID: 7
message ThrottlingSettings {
// The round trip time in milliseconds.
double rtt_ms = 1;

// The network throughput in kilobits per second.
double throughput_kbps = 2;

// The network request latency in milliseconds.
double request_latency_ms = 3;

// The network download throughput in kilobits per second.
double download_throughput_kbps = 4;

// The network upload throughput in kilobits per second.
double upload_throughput_kbps = 5;

// The amount of slowdown applied to the cpu (1/<cpuSlowdownMultiplier>).
double cpu_slowdown_multiplier = 6;
}

// The throttling config settings.
ThrottlingSettings throttling = 7;

// The method used to throttle the network.
string throttling_method = 8;
}

// The settings that were used to run this audit
Expand Down