Chromium Code Reviews| Index: components/chrome_apps/webstore_widget/app/main.js |
| diff --git a/components/chrome_apps/webstore_widget/app/main.js b/components/chrome_apps/webstore_widget/app/main.js |
| index 1151da84a367588a199a5f6da0440fa529f86c89..8ada750b1506c200c131b721ac1eeb81651665ce 100644 |
| --- a/components/chrome_apps/webstore_widget/app/main.js |
| +++ b/components/chrome_apps/webstore_widget/app/main.js |
| @@ -68,20 +68,50 @@ function createPlatformDelegate(strings) { |
| metricsImpl: { |
| /** |
| + * Map from interval name to interval start timestamp. |
| + * @type {Object<string, Date>} |
| + */ |
| + intervals: {}, |
| + |
| + /** |
| * @param {string} enumName |
| * @param {number} value |
| * @param {number} enumSize |
| */ |
| - recordEnum: function(enumName, value, enumSize) {}, |
| + recordEnum: function(enumName, value, enumSize) { |
| + var index = (value >= 0 && value < enumSize) ? value : enumSize - 1; |
| + chrome.metricsPrivate.recordValue({ |
| + 'metricName': 'WebstoreWidgetApp.' + enumName, |
| + 'type': 'histogram-linear', |
| + 'min': 1, |
| + 'max': enumSize, |
| + 'buckets': enumSize |
|
Ilya Sherman
2015/06/25 21:40:29
Hmm, I think that either max should be "enumSize -
tbarzic
2015/06/25 22:31:09
This is how these values are recorded in File Mana
Ilya Sherman
2015/06/25 22:36:31
It's fine for the underflow bucket to be emitted t
tbarzic
2015/06/25 22:46:12
Done.
|
| + }, index); |
| + }, |
| /** @param {string} actionName */ |
| - recordUserAction: function(actionName) {}, |
| + recordUserAction: function(actionName) { |
| + chrome.metricsPrivate.recordUserAction( |
| + 'WebstoreWidgetApp.' + actionName); |
|
Ilya Sherman
2015/06/25 21:40:30
Please update actions.xml with any actions that yo
tbarzic
2015/06/25 22:31:09
Done.
|
| + }, |
| /** @param {string} intervalName */ |
| - startInterval: function(intervalName) {}, |
| + startInterval: function(intervalName) { |
| + this.intervals[intervalName] = Date.now(); |
| + }, |
| /** @param {string} intervalName */ |
| - recordInterval: function(intervalName) {} |
| + recordInterval: function(intervalName) { |
| + if (!intervalName in this.intervals) { |
| + console.error('Interval \'' + intervalName + '\' not started'); |
| + return; |
| + } |
| + |
| + chrome.metricsPrivate.recordTime( |
| + 'WebstoreWidgetApp.' + intervalName, |
| + Date.now() - this.intervals[intervalName]); |
| + delete this.intervals[intervalName]; |
| + } |
| }, |
| /** |