Commit 1e920b32 authored by Ryan Sturm's avatar Ryan Sturm Committed by Commit Bot

Adding device memory in kb to the client config request

pingback will also have this information

Bug: 793373
Change-Id: I0c999c35b5e968f6b2e19696a08a722b3399d0d9
Reviewed-on: https://chromium-review.googlesource.com/823176Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Ryan Sturm <ryansturm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524203}
parent a2b00295
......@@ -18,6 +18,7 @@
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/sys_info.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h"
......@@ -383,6 +384,10 @@ void DataReductionProxyConfigServiceClient::RetrieveRemoteConfig() {
request.set_telephony_network_operator(
net::android::GetTelephonyNetworkOperator());
#endif
data_reduction_proxy::DeviceInfo* device_info = request.mutable_device_info();
device_info->set_total_device_memory_kb(
base::SysInfo::AmountOfPhysicalMemory() / 1024);
const std::string& session_key = request_options_->GetSecureSession();
if (!session_key.empty())
request.set_session_key(request_options_->GetSecureSession());
......
......@@ -10,6 +10,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/optional.h"
#include "base/rand_util.h"
#include "base/sys_info.h"
#include "base/time/time.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_page_load_timing.h"
......@@ -96,6 +97,10 @@ void AddDataToPageloadMetrics(const DataReductionProxyData& request_data,
request_data.effective_connection_type()));
request->set_compressed_page_size_bytes(timing.network_bytes);
request->set_original_page_size_bytes(timing.original_network_bytes);
data_reduction_proxy::DeviceInfo* device_info =
request->mutable_device_info();
device_info->set_total_device_memory_kb(
base::SysInfo::AmountOfPhysicalMemory() / 1024);
if (request_data.page_id()) {
request->set_page_id(request_data.page_id().value());
......
......@@ -16,6 +16,7 @@
#include "base/metrics/field_trial.h"
#include "base/optional.h"
#include "base/run_loop.h"
#include "base/sys_info.h"
#include "base/test/histogram_tester.h"
#include "base/time/time.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h"
......@@ -221,6 +222,9 @@ TEST_F(DataReductionProxyPingbackClientTest, VerifyPingbackContent) {
PageloadMetrics_EffectiveConnectionType_EFFECTIVE_CONNECTION_TYPE_OFFLINE,
pageload_metrics.effective_connection_type());
EXPECT_EQ(std::string(), pageload_metrics.holdback_group());
EXPECT_EQ(base::SysInfo::AmountOfPhysicalMemory() / 1024,
pageload_metrics.device_info().total_device_memory_kb());
test_fetcher->delegate()->OnURLFetchComplete(test_fetcher);
histogram_tester().ExpectUniqueSample(kHistogramSucceeded, true, 1);
EXPECT_FALSE(factory()->GetFetcherByID(0));
......@@ -331,6 +335,9 @@ TEST_F(DataReductionProxyPingbackClientTest, VerifyTwoPingbacksBatchedContent) {
EXPECT_EQ(
PageloadMetrics_EffectiveConnectionType_EFFECTIVE_CONNECTION_TYPE_OFFLINE,
pageload_metrics.effective_connection_type());
EXPECT_EQ(base::SysInfo::AmountOfPhysicalMemory() / 1024,
pageload_metrics.device_info().total_device_memory_kb());
}
test_fetcher->delegate()->OnURLFetchComplete(test_fetcher);
......
......@@ -115,6 +115,12 @@ message ProxyServer {
optional ProxyType type = 4;
}
// Information about the device the user is on.
message DeviceInfo {
// Kilobytes of total device memory.
optional int64 total_device_memory_kb = 1;
}
// Request object to create a client configuration object.
message CreateClientConfigRequest {
// An enum representing the type of user regarding whether they are dogfooding
......@@ -143,6 +149,9 @@ message CreateClientConfigRequest {
// The DogfoodGroup of the user.
// Added in M65.
optional DogfoodGroup dogfood_group = 4;
// Added in M65.
optional DeviceInfo device_info = 5;
}
// Build version information.
......
......@@ -105,4 +105,7 @@ message PageloadMetrics {
// The name of the finch group for the data reduction proxy holdback
// experiment. This can be an empty string if not included in a finch group.
optional string holdback_group = 19;
// Added in M65.
optional DeviceInfo device_info = 20;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment