Skip to content

Commit

Permalink
misc(proto): add throttling and throttling_method (#13309)
Browse files Browse the repository at this point in the history
  • Loading branch information
exterkamp authored Nov 2, 2021
1 parent 8a29854 commit 05e6713
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
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

0 comments on commit 05e6713

Please sign in to comment.