OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.contextualsearch; | 5 package org.chromium.chrome.browser.contextualsearch; |
6 | 6 |
7 import java.net.URL; | |
8 | |
7 /** | 9 /** |
8 * An interface for logging to UMA via Ranker. | 10 * An interface for logging to UMA via Ranker. |
9 */ | 11 */ |
10 public interface ContextualSearchRankerLogger { | 12 public interface ContextualSearchRankerLogger { |
11 enum Feature { | 13 enum Feature { |
12 UNKNOWN, | 14 UNKNOWN, |
13 // Outcome labels: | 15 // Outcome labels: |
14 OUTCOME_WAS_PANEL_OPENED, | 16 OUTCOME_WAS_PANEL_OPENED, |
15 OUTCOME_WAS_QUICK_ACTION_CLICKED, | 17 OUTCOME_WAS_QUICK_ACTION_CLICKED, |
16 OUTCOME_WAS_QUICK_ANSWER_SEEN, | 18 OUTCOME_WAS_QUICK_ANSWER_SEEN, |
17 // Features: | 19 // Features: |
18 DURATION_AFTER_SCROLL_MS, | 20 DURATION_AFTER_SCROLL_MS, |
19 DURATION_BEFORE_SCROLL_MS, | 21 DURATION_BEFORE_SCROLL_MS, |
20 SCREEN_TOP_DPS, | 22 SCREEN_TOP_DPS, |
21 WAS_SCREEN_BOTTOM, | 23 WAS_SCREEN_BOTTOM, |
22 // User usage features: | 24 // User usage features: |
23 PREVIOUS_WEEK_IMPRESSIONS_COUNT, | 25 PREVIOUS_WEEK_IMPRESSIONS_COUNT, |
24 PREVIOUS_WEEK_CTR_PERCENT, | 26 PREVIOUS_WEEK_CTR_PERCENT, |
25 PREVIOUS_28DAY_IMPRESSIONS_COUNT, | 27 PREVIOUS_28DAY_IMPRESSIONS_COUNT, |
26 PREVIOUS_28DAY_CTR_PERCENT | 28 PREVIOUS_28DAY_CTR_PERCENT |
27 } | 29 } |
28 | 30 |
29 /** | 31 /** |
30 * Logs a particular key/value pair. | 32 * Sets up logging for the page with the given URL. |
33 * This method must be called before calling {@link #log} or {@link #logOutc ome}. | |
34 * @param basePageUrl The URL of the base page to log with Ranker. | |
35 */ | |
36 void setupLoggingForPage(URL basePageUrl); | |
Donn Denman
2017/05/12 23:08:55
Updated this method name and description to reflec
| |
37 | |
38 /** | |
39 * Logs a particular feature at inference time as a key/value pair. | |
31 * @param feature The feature to log. | 40 * @param feature The feature to log. |
32 * @param value The value to log, which is associated with the given key. | 41 * @param value The value to log, which is associated with the given key. |
33 */ | 42 */ |
34 void log(Feature feature, Object value); | 43 void log(Feature feature, Object value); |
35 | 44 |
36 /** | 45 /** |
37 * Logs the final outcome value that indicates the ML label. | 46 * Logs an outcome value at training time that indicates an ML label as a ke y/value pair. |
47 * @param feature The feature to log. | |
38 * @param value The outcome label value. | 48 * @param value The outcome label value. |
39 */ | 49 */ |
40 void logOutcome(Object value); | 50 void logOutcome(Feature feature, Object value); |
41 | 51 |
42 /** | 52 /** |
43 * Writes all the accumulated log entries and resets the logger so that futu re log calls | 53 * Writes all the accumulated log entries and resets the logger so that futu re log calls |
44 * accumulate into a new record. | 54 * accumulate into a new record. |
55 * After calling this method another call to {@link #setupLoggingForPage} is required before | |
56 * additional {@link #log} or {@link #logOutcome} calls. | |
45 */ | 57 */ |
46 void writeLogAndReset(); | 58 void writeLogAndReset(); |
47 } | 59 } |
OLD | NEW |