0

Log CheckDelta when response status is SuccessWithRealTime

Since GMSCore is still rolling out, a lot of real time checks fall
back to local blocklist checks. Add a histogram that logs CheckDelta
only if the response status is SuccessWithRealTime so that we get
a clear picture of the latency of real time check.

Bug: 40911907
Change-Id: I53ee1b2289744a6f40789c28c7a72e6168a571b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5319779
Reviewed-by: thefrog <thefrog@chromium.org>
Commit-Queue: Xinghui Lu <xinghuilu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1264634}
This commit is contained in:
Xinghui Lu
2024-02-23 18:03:45 +00:00
committed by Chromium LUCI CQ
parent 30f860debb
commit 00e344554b
3 changed files with 36 additions and 0 deletions
components/safe_browsing/android
tools/metrics/histograms/metadata/safe_browsing

@ -124,6 +124,13 @@ void ReportSafeBrowsingJavaResponse(
ReportUmaHistogramSparseWithAndWithoutSuffix(
"SafeBrowsing.GmsSafeBrowsingApi.ResponseStatus", suffix,
static_cast<int>(response_status));
if (response_status ==
SafeBrowsingJavaResponseStatus::SUCCESS_WITH_REAL_TIME) {
base::UmaHistogramMicrosecondsTimes(
"SafeBrowsing.GmsSafeBrowsingApi.CheckDelta.SuccessWithRealTime",
base::Microseconds(check_delta_microseconds));
}
}
SafeBrowsingJavaValidationResult GetJavaValidationResult(

@ -294,6 +294,18 @@ class SafeBrowsingApiHandlerBridgeTest : public testing::Test {
"SafeBrowsing.GmsSafeBrowsingApi.ResponseStatus" + suffix,
/*sample=*/expected_response_status.value(),
/*expected_bucket_count=*/1);
if (expected_response_status.value() ==
static_cast<int>(
SafeBrowsingJavaResponseStatus::SUCCESS_WITH_REAL_TIME)) {
histogram_tester_.ExpectUniqueSample(
"SafeBrowsing.GmsSafeBrowsingApi.CheckDelta.SuccessWithRealTime",
/*sample=*/kExpectedSafeBrowsingCheckDeltaMicroseconds,
/*expected_bucket_count=*/1);
} else {
histogram_tester_.ExpectTotalCount(
"SafeBrowsing.GmsSafeBrowsingApi.CheckDelta.SuccessWithRealTime",
/*expected_count=*/0);
}
} else {
histogram_tester_.ExpectTotalCount(
/*name=*/"SafeBrowsing.GmsSafeBrowsingApi.ResponseStatus",

@ -1048,6 +1048,23 @@ chromium-metrics-reviews@google.com.
</summary>
</histogram>
<histogram
name="SafeBrowsing.GmsSafeBrowsingApi.CheckDelta.SuccessWithRealTime"
units="microseconds" expires_after="2024-07-07">
<owner>xinghuilu@chromium.org</owner>
<owner>chrome-counter-abuse-alerts@google.com</owner>
<summary>
The microseconds between sending the SafeBrowsing API real time call and
receiving the SUCCESS_WITH_REAL_TIME response. The end time is fixed in java
code and does not include any thread hops or extra work. Note that this does
include task queue time to respond to the IPC (and that queue time is often
non-trivial). This is logged each time a SUCCESS_WITH_REAL_TIME response is
received from SafeBrowsing API.
This histogram only records metrics on machines with high-resolution clocks.
</summary>
</histogram>
<histogram name="SafeBrowsing.GmsSafeBrowsingApi.CheckDelta{Protocol}"
units="microseconds" expires_after="2024-07-07">
<owner>xinghuilu@chromium.org</owner>