Commit 50ff1a27 authored by ttuttle's avatar ttuttle Committed by Commit bot

Domain Reliability: Add was_proxied field to beacons.

This makes it explicit why server_ip is blank when the connection was
proxied, so we can tell when it's blank because of a bug instead.

BUG=

Review URL: https://codereview.chromium.org/1088933007

Cr-Commit-Position: refs/heads/master@{#326739}
parent b605e72e
......@@ -33,6 +33,7 @@ Value* DomainReliabilityBeacon::ToValue(
beacon_value->Set("failure_data", failure_value);
}
beacon_value->SetString("server_ip", server_ip);
beacon_value->SetBoolean("was_proxied", was_proxied);
beacon_value->SetString("protocol", protocol);
if (http_response_code >= 0)
beacon_value->SetInteger("http_response_code", http_response_code);
......
......@@ -39,6 +39,9 @@ struct DOMAIN_RELIABILITY_EXPORT DomainReliabilityBeacon {
int chrome_error;
// IP address of the server the request went to.
std::string server_ip;
// Whether the request went through a proxy. If true, |server_ip| will be
// empty.
bool was_proxied;
// Protocol used to make the request.
std::string protocol;
// HTTP response code returned by the server, or -1 if none was received.
......
......@@ -30,6 +30,7 @@ DomainReliabilityBeacon MakeBeacon(MockableTime* time) {
beacon.status = "ok";
beacon.chrome_error = net::OK;
beacon.server_ip = "127.0.0.1";
beacon.was_proxied = false;
beacon.protocol = "HTTP";
beacon.http_response_code = 200;
beacon.elapsed = base::TimeDelta::FromMilliseconds(250);
......@@ -179,7 +180,8 @@ TEST_F(DomainReliabilityContextTest, ReportUpload) {
"\"http_response_code\":200,\"network_changed\":false,"
"\"protocol\":\"HTTP\",\"request_age_ms\":300250,"
"\"request_elapsed_ms\":250,\"resource\":\"always_report\","
"\"server_ip\":\"127.0.0.1\",\"status\":\"ok\"}],"
"\"server_ip\":\"127.0.0.1\",\"status\":\"ok\","
"\"was_proxied\":false}],"
"\"reporter\":\"test-reporter\","
"\"resources\":[{\"failed_requests\":0,\"name\":\"always_report\","
"\"successful_requests\":1}]}";
......@@ -216,7 +218,8 @@ TEST_F(DomainReliabilityContextTest, ReportUpload_NetworkChanged) {
"\"http_response_code\":200,\"network_changed\":true,"
"\"protocol\":\"HTTP\",\"request_age_ms\":300250,"
"\"request_elapsed_ms\":250,\"resource\":\"always_report\","
"\"server_ip\":\"127.0.0.1\",\"status\":\"ok\"}],"
"\"server_ip\":\"127.0.0.1\",\"status\":\"ok\","
"\"was_proxied\":false}],"
"\"reporter\":\"test-reporter\","
"\"resources\":[{\"failed_requests\":0,\"name\":\"always_report\","
"\"successful_requests\":1}]}";
......
......@@ -280,6 +280,7 @@ void DomainReliabilityMonitor::OnRequestLegComplete(
beacon.http_response_code = response_code;
beacon.start_time = request.load_timing_info.request_start;
beacon.elapsed = time_->NowTicks() - beacon.start_time;
beacon.was_proxied = request.response_info.was_fetched_via_proxy;
beacon.domain = request.url.host();
context_manager_.RouteBeacon(request.url, beacon);
}
......
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