Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelMetrics.java

Issue 2857333002: [TTS] Write initial Tap-features to Ranker. (Closed)
Patch Set: Added logging of the CS-model URL and updated console-logging output. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.compositor.bottombar.contextualsearch; 5 package org.chromium.chrome.browser.compositor.bottombar.contextualsearch;
6 6
7 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState; 7 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState;
8 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChange Reason; 8 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChange Reason;
9 import org.chromium.chrome.browser.contextualsearch.ContextualSearchHeuristics; 9 import org.chromium.chrome.browser.contextualsearch.ContextualSearchHeuristics;
10 import org.chromium.chrome.browser.contextualsearch.ContextualSearchRankerLogger ; 10 import org.chromium.chrome.browser.contextualsearch.ContextualSearchRankerLogger ;
11 import org.chromium.chrome.browser.contextualsearch.ContextualSearchRankerLogger Impl; 11 import org.chromium.chrome.browser.contextualsearch.ContextualSearchRankerLogger Impl;
12 import org.chromium.chrome.browser.contextualsearch.ContextualSearchUma; 12 import org.chromium.chrome.browser.contextualsearch.ContextualSearchUma;
13 import org.chromium.chrome.browser.contextualsearch.QuickActionCategory; 13 import org.chromium.chrome.browser.contextualsearch.QuickActionCategory;
14 14
15 import java.net.URL;
16
15 /** 17 /**
16 * This class is responsible for all the logging related to Contextual Search. 18 * This class is responsible for all the logging related to Contextual Search.
17 */ 19 */
18 public class ContextualSearchPanelMetrics { 20 public class ContextualSearchPanelMetrics {
19 private static final int MILLISECONDS_TO_NANOSECONDS = 1000000; 21 private static final int MILLISECONDS_TO_NANOSECONDS = 1000000;
20 22
21 // The Ranker logger to use to write Tap Suppression Ranker logs to UMA. 23 // The Ranker logger to use to write Tap Suppression Ranker logs to UMA.
22 private final ContextualSearchRankerLogger mTapSuppressionRankerLogger; 24 private final ContextualSearchRankerLogger mTapSuppressionRankerLogger;
23 25
24 // Flags for logging. 26 // Flags for logging.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 135 }
134 136
135 if (mWasActivatedByTap) { 137 if (mWasActivatedByTap) {
136 boolean wasAnySuppressionHeuristicSatisfied = mWasAnyHeuristicSa tisfiedOnPanelShow; 138 boolean wasAnySuppressionHeuristicSatisfied = mWasAnyHeuristicSa tisfiedOnPanelShow;
137 ContextualSearchUma.logAnyTapSuppressionHeuristicSatisfied( 139 ContextualSearchUma.logAnyTapSuppressionHeuristicSatisfied(
138 mWasSearchContentViewSeen, wasAnySuppressionHeuristicSat isfied); 140 mWasSearchContentViewSeen, wasAnySuppressionHeuristicSat isfied);
139 // Log all the experiments to the Ranker logger. 141 // Log all the experiments to the Ranker logger.
140 if (mRankerLogExperiments != null) { 142 if (mRankerLogExperiments != null) {
141 mTapSuppressionRankerLogger.logOutcome(mWasSearchContentView Seen); 143 mTapSuppressionRankerLogger.logOutcome(mWasSearchContentView Seen);
142 mRankerLogExperiments.logRankerTapSuppression(mTapSuppressio nRankerLogger); 144 mRankerLogExperiments.logRankerTapSuppression(mTapSuppressio nRankerLogger);
143 mTapSuppressionRankerLogger.writeLogAndReset();
144 mRankerLogExperiments = null; 145 mRankerLogExperiments = null;
145 } 146 }
147 mTapSuppressionRankerLogger.writeLogAndReset();
Theresa 2017/05/12 01:02:25 Why was just this line pulled out of the if (mRank
Donn Denman 2017/05/12 23:08:55 I noticed that we log to Ranker in multiple places
Theresa 2017/05/18 15:35:11 Will you please add a code comment with some of th
Donn Denman 2017/05/18 18:06:07 Done.
146 148
147 ContextualSearchUma.logSelectionLengthResultsSeen( 149 ContextualSearchUma.logSelectionLengthResultsSeen(
148 mWasSearchContentViewSeen, mSelectionLength); 150 mWasSearchContentViewSeen, mSelectionLength);
149 } 151 }
150 } 152 }
151 153
152 if (isExitingPanelOpenedBeyondPeeked) { 154 if (isExitingPanelOpenedBeyondPeeked) {
153 assert mPanelOpenedBeyondPeekTimeNs != 0; 155 assert mPanelOpenedBeyondPeekTimeNs != 0;
154 long durationPanelOpen = (System.nanoTime() - mPanelOpenedBeyondPeek TimeNs) 156 long durationPanelOpen = (System.nanoTime() - mPanelOpenedBeyondPeek TimeNs)
155 / MILLISECONDS_TO_NANOSECONDS; 157 / MILLISECONDS_TO_NANOSECONDS;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 /** 319 /**
318 * Sets the experiments to log with results seen. 320 * Sets the experiments to log with results seen.
319 * @param resultsSeenExperiments The experiments to log when the panel resul ts are known. 321 * @param resultsSeenExperiments The experiments to log when the panel resul ts are known.
320 */ 322 */
321 public void setResultsSeenExperiments(ContextualSearchHeuristics resultsSeen Experiments) { 323 public void setResultsSeenExperiments(ContextualSearchHeuristics resultsSeen Experiments) {
322 mResultsSeenExperiments = resultsSeenExperiments; 324 mResultsSeenExperiments = resultsSeenExperiments;
323 } 325 }
324 326
325 /** 327 /**
326 * Sets the experiments to log through Ranker with results seen. 328 * Sets the experiments to log through Ranker with results seen.
327 * @param rankerLogExperiments The experiments to log through ranker when th e panel results 329 * @param rankerLogExperiments The experiments to log through Ranker when th e panel results
328 * are known. 330 * are known.
331 * @param basePageUrl The URL of the base page to log along with Ranker data .
329 */ 332 */
330 public void setRankerLogExperiments(ContextualSearchHeuristics rankerLogExpe riments) { 333 public void setRankerLogExperiments(
334 ContextualSearchHeuristics rankerLogExperiments, URL basePageUrl) {
331 mRankerLogExperiments = rankerLogExperiments; 335 mRankerLogExperiments = rankerLogExperiments;
336 mTapSuppressionRankerLogger.setBasePageUrl(basePageUrl);
332 } 337 }
333 338
334 /** 339 /**
335 * Determine whether a new contextual search is starting. 340 * Determine whether a new contextual search is starting.
336 * @param toState The contextual search state that will be transitioned to. 341 * @param toState The contextual search state that will be transitioned to.
337 * @param reason The reason for the search state transition. 342 * @param reason The reason for the search state transition.
338 * @return Whether a new contextual search is starting. 343 * @return Whether a new contextual search is starting.
339 */ 344 */
340 private boolean isStartingNewContextualSearch(PanelState toState, StateChang eReason reason) { 345 private boolean isStartingNewContextualSearch(PanelState toState, StateChang eReason reason) {
341 return toState == PanelState.PEEKED 346 return toState == PanelState.PEEKED
(...skipping 16 matching lines...) Expand all
358 363
359 /** 364 /**
360 * @param fromState The state the panel is transitioning from. 365 * @param fromState The state the panel is transitioning from.
361 * @return Whether there is an ongoing contextual search. 366 * @return Whether there is an ongoing contextual search.
362 */ 367 */
363 private boolean isOngoingContextualSearch(PanelState fromState) { 368 private boolean isOngoingContextualSearch(PanelState fromState) {
364 return fromState != PanelState.UNDEFINED && fromState != PanelState.CLOS ED; 369 return fromState != PanelState.UNDEFINED && fromState != PanelState.CLOS ED;
365 } 370 }
366 } 371 }
367 372
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698