Commit 04d4389a authored by Donn Denman's avatar Donn Denman Committed by Commit Bot

[TTS] Add Unified Consent integration histograms.

Aids with the integration of Contextual Search with Unified Consent by
recording whether the user was previously undecided when their
preference gets changed due to Unified Consent, and whether to throttle
for every request and when throttling is in effect.

BUG=829597

Change-Id: I28c10e10faee25dd6741243c4560d9ed74fa75ef
Reviewed-on: https://chromium-review.googlesource.com/1214402Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Donn Denman <donnd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590504}
parent c404b263
......@@ -60,10 +60,12 @@ class ContextualSearchPreferenceHelper {
* previously undecided.
*/
public boolean canThrottle() {
return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
ChromeFeatureList.CONTEXTUAL_SEARCH_UNITY_INTEGRATION,
ContextualSearchPreferenceHelper.THROTTLE, false)
boolean isRequestThrottled = ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
ChromeFeatureList.CONTEXTUAL_SEARCH_UNITY_INTEGRATION,
ContextualSearchPreferenceHelper.THROTTLE, false)
&& wasUndecided();
ContextualSearchUma.logUnifiedConsentThrottledRequests(isRequestThrottled);
return isRequestThrottled;
}
/** Updates our preference metadata storage based on what our native member knows. */
......@@ -88,9 +90,11 @@ class ContextualSearchPreferenceHelper {
/** @return Whether the user was "undecided" before Unified Consent changed their setting. */
private boolean wasUndecided() {
return ContextualSearchPreviousPreferenceMetadata.WAS_UNDECIDED
boolean isThrottleEligible = ContextualSearchPreviousPreferenceMetadata.WAS_UNDECIDED
== ChromePreferenceManager.getInstance().readInt(
ChromePreferenceManager.CONTEXTUAL_SEARCH_PRE_UNIFIED_CONSENT_PREF);
ContextualSearchUma.logUnifiedConsentThrottleEligible(isThrottleEligible);
return isThrottleEligible;
}
/** @return Whether we know if Unified Consent changed their setting. */
......@@ -106,6 +110,8 @@ class ContextualSearchPreferenceHelper {
assert setting != ContextualSearchPreviousPreferenceMetadata.UNKNOWN;
ChromePreferenceManager.getInstance().writeInt(
ChromePreferenceManager.CONTEXTUAL_SEARCH_PRE_UNIFIED_CONSENT_PREF, setting);
ContextualSearchUma.logUnifiedConsentPreviousEnabledState(
setting == ContextualSearchPreviousPreferenceMetadata.WAS_UNDECIDED);
}
/**
......
......@@ -1488,6 +1488,37 @@ public class ContextualSearchUma {
"Search.ContextualSearch.Ranker.FeaturesAvailable", areOutcomes);
}
/**
* Logs the previous enabled-state of this user before the feature was turned full-on for
* Unified Consent (when integration is enabled).
* @param wasPreviouslyUndecided Whether the user was previously undecided.
*/
static void logUnifiedConsentPreviousEnabledState(boolean wasPreviouslyUndecided) {
RecordHistogram.recordBooleanHistogram(
"Search.ContextualSearch.UnifiedConsent.PreviouslyUndecided",
wasPreviouslyUndecided);
}
/**
* Logs whether a request will be throttled for Unified Consent integration, for all requests
* regardless of whether the integration feature is enabled. Logged multiple times per request.
* @param isRequestThrottled Whether the current request is being throttled.
*/
static void logUnifiedConsentThrottledRequests(boolean isRequestThrottled) {
RecordHistogram.recordBooleanHistogram(
"Search.ContextualSearch.UnifiedConsent.ThrottledRequests", isRequestThrottled);
}
/**
* Logs whether this user was eligible for throttling of requests when Unified Consent
* integration is enabled and throttling is in effect.
* @param isThrottleEligible Whether this user is eligible to be throttled.
*/
static void logUnifiedConsentThrottleEligible(boolean isThrottleEligible) {
RecordHistogram.recordBooleanHistogram(
"Search.ContextualSearch.UnifiedConsent.ThrottleEligible", isThrottleEligible);
}
/**
* Gets the state-change code for the given parameters by doing a lookup in the given map.
* @param state The panel state.
......
......@@ -91472,6 +91472,44 @@ uploading your change for review.
</summary>
</histogram>
<histogram name="Search.ContextualSearch.UnifiedConsent.PreviouslyUndecided"
enum="Boolean" expires_after="2019-01-30">
<owner>donnd@chromium.org</owner>
<owner>twellington@chromium.org</owner>
<summary>
Records the previous state of the user's enabled preference to indicate
whether they were decided or undecided about fully enabling this feature.
Recorded during the rollout of Unified Consent when the Contextual Search
preference is changed. Implemented for Android.
</summary>
</histogram>
<histogram name="Search.ContextualSearch.UnifiedConsent.ThrottledRequests"
enum="Boolean" expires_after="2019-01-30">
<owner>donnd@chromium.org</owner>
<owner>twellington@chromium.org</owner>
<summary>
Records whether throttling for Unified Consent was done for all requests.
Recorded when the user taps on text and the system would like the server to
suggest what to search for using page context, regardless of feature-enabled
state. Recorded multiple times for each request. Supports the rollout of
Unified Consent for Contextual Search. Implemented for Android.
</summary>
</histogram>
<histogram name="Search.ContextualSearch.UnifiedConsent.ThrottleEligible"
enum="Boolean" expires_after="2019-01-30">
<owner>donnd@chromium.org</owner>
<owner>twellington@chromium.org</owner>
<summary>
Records whether this user had a request throttled or not when needed.
Recorded when the user taps on text and the system would like the server to
suggest what to search for using page context, and throttling is in effect
for this user. Supports the rollout of Unified Consent for Contextual
Search. Implemented for Android.
</summary>
</histogram>
<histogram name="Search.ContextualSearchAllCapsResultsSeen"
enum="ContextualSearchResultsSeen">
<obsolete>
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