Commit b6702628 authored by Stuart Langley's avatar Stuart Langley Committed by Commit Bot

Remove google analytics from DriveDuplicateFinder.

Replace the exiting data that was being recorded using GA with UMA
for long hash calculate and search by hash results.

GA was disabled some time back so this data has not been being
recorded for some time. We'll switch to UMA for the time being and
then make a decision on either keeping or removing these metrics
altogether at a later date.

Bug: 847729
Change-Id: I6b2fac50a3275b1cd3684ef3b438f26d147ea64c
Reviewed-on: https://chromium-review.googlesource.com/c/1341434
Commit-Queue: Stuart Langley <slangley@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Reviewed-by: default avatarNaoki Fukino <fukino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610275}
parent 6d3e5f48
......@@ -34507,6 +34507,26 @@ uploading your change for review.
</summary>
</histogram>
<histogram name="FileBrowser.DriveDuplicateFinder.LongComputeHash" units="ms"
expires_after="M79">
<owner>slangley@gchromium.org</owner>
<owner>weifangsun@chromium.org</owner>
<summary>
The time taken to calculate the hash of a file, only recorded if the time
exceeds a local threshold that is currenty 5 seconds.
</summary>
</histogram>
<histogram name="FileBrowser.DriveDuplicateFinder.LongSearchByHash" units="ms"
expires_after="M79">
<owner>slangley@gchromium.org</owner>
<owner>weifangsun@chromium.org</owner>
<summary>
The time taken to search for a file using it's hash value, only recorded if
the time exceeds a local threshold that is currently 1 second.
</summary>
</histogram>
<histogram name="FileBrowser.FolderShortcut.Add">
<owner>sashab@chromium.org</owner>
<owner>slangley@chromium.org</owner>
......@@ -61,8 +61,8 @@ function FileBrowserBackgroundImpl() {
/**
* @type {!importer.DispositionChecker.CheckerFunction}
*/
this.dispositionChecker_ = importer.DispositionChecker.createChecker(
this.historyLoader, this.tracker);
this.dispositionChecker_ =
importer.DispositionChecker.createChecker(this.historyLoader);
/**
* Provides support for scaning media devices as part of Cloud Import.
......
......@@ -10,14 +10,8 @@ var importer = importer || {};
*
* @constructor
* @struct
*
* @param {!analytics.Tracker} tracker
*/
importer.DriveDuplicateFinder = function(tracker) {
/** @private {!analytics.Tracker} */
this.tracker_ = tracker;
importer.DriveDuplicateFinder = function() {
/** @private {Promise<string>} */
this.driveIdPromise_ = null;
......@@ -87,10 +81,8 @@ importer.DriveDuplicateFinder.prototype.computeHash_ = function(entry) {
importer.DriveDuplicateFinder.HASH_EVENT_THRESHOLD_) {
console.info(
'Content hash computation took ' + elapsedTime + ' ms.');
this.tracker_.sendTiming(
metrics.Categories.ACQUISITION,
metrics.timing.Variables.COMPUTE_HASH,
elapsedTime);
metrics.recordTime(
'DriveDuplicateFinder.LongComputeHash', elapsedTime);
}
if (chrome.runtime.lastError) {
reject(chrome.runtime.lastError);
......@@ -163,10 +155,8 @@ importer.DriveDuplicateFinder.prototype.searchFilesByHash_ =
// Send the timing to GA only if it is sorta exceptionally long.
if (elapsedTime >=
importer.DriveDuplicateFinder.SEARCH_EVENT_THRESHOLD_) {
this.tracker_.sendTiming(
metrics.Categories.ACQUISITION,
metrics.timing.Variables.SEARCH_BY_HASH,
elapsedTime);
metrics.recordTime(
'DriveDuplicateFinder.LongSearchByHash', elapsedTime);
}
if (chrome.runtime.lastError) {
reject(chrome.runtime.lastError);
......@@ -283,14 +273,11 @@ importer.DispositionChecker.prototype.hasHistoryDuplicate_ =
* Factory for a function that returns an entry's disposition.
*
* @param {!importer.HistoryLoader} historyLoader
* @param {!analytics.Tracker} tracker
*
* @return {!importer.DispositionChecker.CheckerFunction}
*/
importer.DispositionChecker.createChecker =
function(historyLoader, tracker) {
importer.DispositionChecker.createChecker = function(historyLoader) {
var checker = new importer.DispositionChecker(
historyLoader,
new importer.DriveDuplicateFinder(tracker));
historyLoader, new importer.DriveDuplicateFinder());
return checker.getDisposition.bind(checker);
};
......@@ -34,7 +34,13 @@ var getDisposition;
loadTimeData.data = {
CLOUD_IMPORT_ITEMS_REMAINING: '',
DRIVE_DIRECTORY_LABEL: 'My Drive',
DOWNLOADS_DIRECTORY_LABEL: 'Downloads'
DRIVE_OFFLINE_COLLECTION_LABEL: 'Offline',
DRIVE_SHARED_WITH_ME_COLLECTION_LABEL: 'Shared with me',
DOWNLOADS_DIRECTORY_LABEL: 'Downloads',
};
window.metrics = {
recordTime: function() {},
};
function setUp() {
......@@ -77,11 +83,8 @@ function setUp() {
};
testHistory = new importer.TestImportHistory();
var tracker = new TestTracker();
duplicateFinder = new importer.DriveDuplicateFinder(tracker);
getDisposition = importer.DispositionChecker.createChecker(
testHistory, tracker);
duplicateFinder = new importer.DriveDuplicateFinder();
getDisposition = importer.DispositionChecker.createChecker(testHistory);
}
// Verifies the correct result when a duplicate exists.
......@@ -97,7 +100,7 @@ function testCheckDuplicateTrue(callback) {
assertTrue(isDuplicate);
}),
callback);
};
}
// Verifies the correct result when a duplicate doesn't exist.
function testCheckDuplicateFalse(callback) {
......@@ -117,7 +120,7 @@ function testCheckDuplicateFalse(callback) {
assertFalse(isDuplicate);
}),
callback);
};
}
function testDispositionChecker_ContentDupe(callback) {
var filePaths = ['/foo.txt'];
......@@ -133,7 +136,7 @@ function testDispositionChecker_ContentDupe(callback) {
disposition);
}),
callback);
};
}
function testDispositionChecker_HistoryDupe(callback) {
var filePaths = ['/foo.txt'];
......@@ -152,7 +155,7 @@ function testDispositionChecker_HistoryDupe(callback) {
disposition);
}),
callback);
};
}
function testDispositionChecker_Original(callback) {
var filePaths = ['/foo.txt'];
......@@ -170,7 +173,7 @@ function testDispositionChecker_Original(callback) {
assertEquals(importer.Disposition.ORIGINAL, disposition);
}),
callback);
};
}
/**
* @param {!Array<string>} filePaths
......
......@@ -142,7 +142,5 @@ metrics.timing = metrics.timing || {};
/** @enum {string} */
metrics.timing.Variables = {
COMPUTE_HASH: 'Compute Content Hash',
SEARCH_BY_HASH: 'Search By Hash',
EXTRACT_THUMBNAIL_FROM_RAW: 'Extract Thumbnail From RAW'
};
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