Commit cf6852c4 authored by Xinghui Lu's avatar Xinghui Lu Committed by Chromium LUCI CQ

Log the size of each real time URL requests

As we add more fields into the proto, we'd like to monitor the network
usage of real time URL check.

Metrics added:
SafeBrowsing.RT.Request.Size

Bug: 1161342
Change-Id: I3bafe5bf7c8a2724d3c75adb2af869702a2db4be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2617575Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Commit-Queue: Xinghui Lu <xinghuilu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841672}
parent b2c13195
......@@ -73,6 +73,13 @@ void RecordCount100WithAndWithoutSuffix(const std::string& metric,
base::UmaHistogramCounts100(metric + suffix, value);
}
void RecordCount1MWithAndWithoutSuffix(const std::string& metric,
const std::string& suffix,
int value) {
base::UmaHistogramCounts1M(metric, value);
base::UmaHistogramCounts1M(metric + suffix, value);
}
void RecordRequestPopulationWithAndWithoutSuffix(
const std::string& metric,
const std::string& suffix,
......@@ -357,6 +364,8 @@ void RealTimeUrlLookupServiceBase::SendRequestInternal(
network::SimpleURLLoader::Create(std::move(resource_request),
GetTrafficAnnotationTag());
network::SimpleURLLoader* loader = owned_loader.get();
RecordCount1MWithAndWithoutSuffix("SafeBrowsing.RT.Request.Size",
GetMetricSuffix(), req_data.size());
owned_loader->AttachStringForUpload(req_data, "application/octet-stream");
owned_loader->SetTimeoutDuration(
base::TimeDelta::FromSeconds(kURLLookupTimeoutDurationInSeconds));
......
......@@ -16021,6 +16021,7 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<affected-histogram name="SafeBrowsing.RT.IsLookupSuccessful"/>
<affected-histogram name="SafeBrowsing.RT.Network.Result"/>
<affected-histogram name="SafeBrowsing.RT.Network.Time"/>
<affected-histogram name="SafeBrowsing.RT.Request.Size"/>
<affected-histogram name="SafeBrowsing.RT.Request.UserPopulation"/>
<affected-histogram name="SafeBrowsing.RT.ThreatInfoSize"/>
</histogram_suffixes>
......
......@@ -1028,6 +1028,16 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>
<histogram name="SafeBrowsing.RT.Request.Size" units="bytes"
expires_after="2022-01-08">
<owner>xinghuilu@chromium.org</owner>
<owner>chrome-safebrowsing-alerts@google.com</owner>
<summary>
The size of a real time URL check request in bytes. Logged on each resource
check for which a lookup request is sent to the server.
</summary>
</histogram>
<histogram name="SafeBrowsing.RT.Request.UserPopulation"
enum="SafeBrowsingUserPopulation" expires_after="2021-05-11">
<owner>xinghuilu@chromium.org</owner>
......
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