0

[iOS] Add histogram for Safety Check freshness signal triggers.

This CL introduces histograms to log the specific triggers behind the
Safety Check Manager's freshness signal updates. These histograms will
provide insights into the frequency of different signal types and help
identify potential areas for improvement, such as excessive logging to
the Segmentation Platform.

Change-Id: Iaba0afb0c48350d33653cd27f61b71a382b0a687
Fixed: 356152264
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5745343
Reviewed-by: Ali Juma <ajuma@chromium.org>
Reviewed-by: Chris Lu <thegreenfrog@chromium.org>
Commit-Queue: Benjamin Williams <bwwilliams@google.com>
Cr-Commit-Position: refs/heads/main@{#1334415}
This commit is contained in:
Benjamin Williams
2024-07-29 20:04:59 +00:00
committed by Chromium LUCI CQ
parent 0f2bc2680e
commit 3847711103
4 changed files with 33 additions and 0 deletions
ios/chrome/browser/safety_check/model
tools/metrics/histograms/metadata/ios

@ -8,6 +8,7 @@
#import "base/functional/bind.h"
#import "base/location.h"
#import "base/metrics/histogram_functions.h"
#import "base/time/time.h"
#import "base/values.h"
#import "components/password_manager/core/browser/leak_detection/leak_detection_request_utils.h"
@ -447,6 +448,9 @@ void IOSChromeSafetyCheckManager::SetPasswordCheckState(
if (should_log_freshness) {
RecordModuleFreshnessSignal(ContentSuggestionsModuleType::kSafetyCheck);
base::UmaHistogramEnumeration(
"IOS.SafetyCheck.FreshnessTrigger",
IOSSafetyCheckFreshnessTrigger::kPasswordCheckStateChanged);
}
password_check_state_ = state;
@ -503,6 +507,9 @@ void IOSChromeSafetyCheckManager::SetUpdateChromeCheckState(
if (should_log_freshness) {
RecordModuleFreshnessSignal(ContentSuggestionsModuleType::kSafetyCheck);
base::UmaHistogramEnumeration(
"IOS.SafetyCheck.FreshnessTrigger",
IOSSafetyCheckFreshnessTrigger::kUpdateChromeCheckStateChanged);
}
update_chrome_check_state_ = state;

@ -17,6 +17,17 @@ const base::TimeDelta kOmahaNetworkWaitTime = base::Seconds(30);
// automatic run can be triggered.
const base::TimeDelta kSafetyCheckAutorunDelay = base::Days(30);
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(IOSSafetyCheckFreshnessTrigger)
enum class IOSSafetyCheckFreshnessTrigger {
kPasswordCheckStateChanged = 0,
kUpdateChromeCheckStateChanged = 1,
kMaxValue = kUpdateChromeCheckStateChanged,
};
// LINT.ThenChange(/tools/metrics/histograms/metadata/ios/enums.xml:IOSSafetyCheckFreshnessTrigger)
// Enum with all possible states of the update check.
enum class UpdateChromeSafetyCheckState {
// When the check has not been run yet.

@ -635,6 +635,11 @@ the generic promo launch. -->
<int value="6" label="Success"/>
</enum>
<enum name="IOSSafetyCheckFreshnessTrigger">
<int value="0" label="Password Check - State Changed"/>
<int value="1" label="Update Chrome Check - State Changed"/>
</enum>
<enum name="IOSSaveToDriveOutcomeType">
<int value="0" label="Failure - WebState Hidden"/>
<int value="1" label="Failure - WebState Destroyed"/>

@ -3437,6 +3437,16 @@ the generic promo launch. -->
</summary>
</histogram>
<histogram name="IOS.SafetyCheck.FreshnessTrigger"
enum="IOSSafetyCheckFreshnessTrigger" expires_after="2025-01-01">
<owner>bwwilliams@google.com</owner>
<owner>thegreenfrog@google.com</owner>
<summary>
This histogram logs the reason for signaling freshness to the Segmentation
Platform when the Safety Check Manager updates the freshness status.
</summary>
</histogram>
<histogram name="IOS.SafetyCheck.MagicStack.ModuleExistsInModuleOrder"
enum="BooleanMatched" expires_after="2024-12-24">
<owner>bwwilliams@google.com</owner>