diff options
author | fukino <fukino@chromium.org> | 2015-08-12 19:51:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-13 02:51:56 +0000 |
commit | 2fb1f4453988ad1a6e4b0851404adbd40f8c5739 (patch) | |
tree | 21892acfa641005e82e7c5c6aeb4c0f54389187d /ui | |
parent | 9fbfa477600d3ecfec300f245a83bb12d5866947 (diff) | |
download | chromium_src-2fb1f4453988ad1a6e4b0851404adbd40f8c5739.zip chromium_src-2fb1f4453988ad1a6e4b0851404adbd40f8c5739.tar.gz chromium_src-2fb1f4453988ad1a6e4b0851404adbd40f8c5739.tar.bz2 |
Files.app: Add analytics exception event for mount errors.
If mounting a volume fails, an exception will be sent to analytics in the following form.
"mount {errorType} {volumeType}"
errorType will be one of followings:
- timoout(requestFileSystem)
- timeout(resolveIsolatedEntries)
- error
volumeType will be one of followings:
- drive
- downloads
- removable
- mtp
- provided:unknown
- provided:ZipUnpacker
- provided:File System for Dropbox (YT)
- provided:File System for OneDrive (YT)
- provided:SFTP File System (YT)
- provided:Box for Chrome OS
- provided:TED Talks (FB)
- provided:WebDAV File System (YT)
- provided:Cloud Storage (FB)
- provided:Scan (FB)
BUG=511286
TEST=manually test that exceptions are reported to analytics by forcing Files.app to fail to mount volumes.
Review URL: https://codereview.chromium.org/1279423004
Cr-Commit-Position: refs/heads/master@{#343153}
Diffstat (limited to 'ui')
6 files changed, 76 insertions, 9 deletions
diff --git a/ui/file_manager/audio_player/manifest.json b/ui/file_manager/audio_player/manifest.json index 38fb787..c8db558 100644 --- a/ui/file_manager/audio_player/manifest.json +++ b/ui/file_manager/audio_player/manifest.json @@ -46,6 +46,7 @@ "app": { "background": { "scripts": [ + "chrome://resources/js/analytics.js", "chrome://resources/js/cr.js", "chrome://resources/js/cr/event_target.js", "chrome://resources/js/cr/ui.js", @@ -56,6 +57,9 @@ "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/util.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/async_util.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/file_type.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/metrics_base.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/metrics_events.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/metrics.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/volume_manager_common.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/background/js/app_window_wrapper.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/background/js/background_base.js", diff --git a/ui/file_manager/file_manager/background/js/volume_manager.js b/ui/file_manager/file_manager/background/js/volume_manager.js index 7551f53..051867f 100644 --- a/ui/file_manager/file_manager/background/js/volume_manager.js +++ b/ui/file_manager/file_manager/background/js/volume_manager.js @@ -234,6 +234,18 @@ VolumeInfo.prototype.resolveDisplayRoot = function(opt_onSuccess, var volumeManagerUtil = {}; /** + * @const {string} + */ +volumeManagerUtil.TIMEOUT_STR_REQUEST_FILE_SYSTEM = + 'timeout(requestFileSystem)'; + +/** + * @const {string} + */ +volumeManagerUtil.TIMEOUT_STR_RESOLVE_ISOLATED_ENTRIES = + 'timeout(resolveIsolatedEntries)'; + +/** * Throws an Error when the given error is not in * VolumeManagerCommon.VolumeError. * @@ -286,7 +298,8 @@ volumeManagerUtil.createVolumeInfo = function(volumeMetadata) { }); }), VolumeManager.TIMEOUT, - 'requestFileSystem timeout: ' + volumeMetadata.volumeId) + volumeManagerUtil.TIMEOUT_STR_REQUEST_FILE_SYSTEM + + ': ' + volumeMetadata.volumeId) .then( /** * @param {!FileSystem} isolatedFileSystem @@ -309,7 +322,8 @@ volumeManagerUtil.createVolumeInfo = function(volumeMetadata) { }); }), VolumeManager.TIMEOUT, - 'resolveIsolatedEntries timeout: ' + volumeMetadata.volumeId); + volumeManagerUtil.TIMEOUT_STR_RESOLVE_ISOLATED_ENTRIES + + ': ' + volumeMetadata.volumeId); }) .then( /** @@ -358,6 +372,8 @@ volumeManagerUtil.createVolumeInfo = function(volumeMetadata) { console.error('Failed to mount a file system: ' + volumeMetadata.volumeId + ' because of: ' + (error.stack || error)); + volumeManagerUtil.reportMountError(volumeMetadata, error); + return new VolumeInfo( /** @type {VolumeManagerCommon.VolumeType} */ (volumeMetadata.volumeType), @@ -378,6 +394,43 @@ volumeManagerUtil.createVolumeInfo = function(volumeMetadata) { }); }; + +/** + * Reports a mount error to analytics in the form of + * "mount {errorType} {volumeType}", like + * "mount timeout(resolveIsolatedEntries) provided:ZipUnpacker". + * Note that errorType and volumeType must be an element of fixed set of strings + * to avoid sending dynamic strings to analytics. + * + * @param {VolumeMetadata} volumeMetadata + * @param {*} error + */ +volumeManagerUtil.reportMountError = function(volumeMetadata, error) { + var errorType = 'error'; + if (error instanceof Error) { + if (error.message.startsWith( + volumeManagerUtil.TIMEOUT_STR_REQUEST_FILE_SYSTEM)) { + errorType = volumeManagerUtil.TIMEOUT_STR_REQUEST_FILE_SYSTEM; + } + if (error.message.startsWith( + volumeManagerUtil.TIMEOUT_STR_RESOLVE_ISOLATED_ENTRIES)) { + errorType = volumeManagerUtil.TIMEOUT_STR_RESOLVE_ISOLATED_ENTRIES; + } + } + var volumeType = volumeMetadata.volumeType; + if (volumeMetadata.volumeType === VolumeManagerCommon.VolumeType.PROVIDED) { + volumeType += ':' + metrics.getFileSystemProviderName( + volumeMetadata.extensionId); + } + var description = 'mount ' + errorType + ' ' + volumeType; + var fatal = + volumeMetadata.volumeType === VolumeManagerCommon.VolumeType.DOWNLOADS || + volumeMetadata.volumeType === VolumeManagerCommon.VolumeType.DRIVE; + + if (window.background && window.background.tracker) + window.background.tracker.sendException(description, fatal); +}; + /** * The order of the volume list based on root type. * @type {Array<VolumeManagerCommon.VolumeType>} diff --git a/ui/file_manager/file_manager/common/js/metrics_events.js b/ui/file_manager/file_manager/common/js/metrics_events.js index ca109c0..d1f63aa 100644 --- a/ui/file_manager/file_manager/common/js/metrics_events.js +++ b/ui/file_manager/file_manager/common/js/metrics_events.js @@ -54,17 +54,19 @@ metrics.FileSystemProviders = { iibcngmpkgghccnakicfmgajlkhnohep: 'TED Talks (FB)', hmckflbfniicjijmdoffagjkpnjgbieh: 'WebDAV File System (YT)', ibfbhbegfkamboeglpnianlggahglbfi: 'Cloud Storage (FB)', - pmnllmkmjilbojkpgplbdmckghmaocjh: 'Scan (FB)' + pmnllmkmjilbojkpgplbdmckghmaocjh: 'Scan (FB)', + mfhnnfciefdpolbelmfkpmhhmlkehbdf: 'File System for SMB/CIFS (YT)', + plmanjiaoflhcilcfdnjeffklbgejmje: 'Add MY Documents (KA)' }; /** - * Returns a new "screen" name for a provided file system type. + * Returns a new "screen" name for a provided file system type. Returns + * 'unknown' for unknown providers. * @param {string|undefined} extensionId The FSP provider extension ID. - * @param {string} defaultName - * @return {string} Name or undefined if extension is unrecognized. + * @return {string} Name or 'unknown' if extension is unrecognized. */ -metrics.getFileSystemProviderName = function(extensionId, defaultName) { - return metrics.FileSystemProviders[extensionId] || defaultName; +metrics.getFileSystemProviderName = function(extensionId) { + return metrics.FileSystemProviders[extensionId] || 'unknown'; }; /** diff --git a/ui/file_manager/file_manager/foreground/js/directory_model.js b/ui/file_manager/file_manager/foreground/js/directory_model.js index 65c9e7b..8482e65 100644 --- a/ui/file_manager/file_manager/foreground/js/directory_model.js +++ b/ui/file_manager/file_manager/foreground/js/directory_model.js @@ -1028,7 +1028,7 @@ DirectoryModel.prototype.onVolumeChanged_ = function(volumeInfo) { case VolumeManagerCommon.VolumeType.PROVIDED: var extensionId = volumeInfo.extensionId; var extensionName = - metrics.getFileSystemProviderName(extensionId, 'unknown'); + metrics.getFileSystemProviderName(extensionId); // Make note of an unrecognized extension id. When we see // high counts for a particular id, we should add it to the // whitelist in metrics_events.js. diff --git a/ui/file_manager/gallery/manifest.json b/ui/file_manager/gallery/manifest.json index cbf9583..4755cda 100644 --- a/ui/file_manager/gallery/manifest.json +++ b/ui/file_manager/gallery/manifest.json @@ -57,6 +57,7 @@ "app": { "background": { "scripts": [ + "chrome://resources/js/analytics.js", "chrome://resources/js/cr.js", "chrome://resources/js/cr/event_target.js", "chrome://resources/js/cr/ui/array_data_model.js", @@ -65,6 +66,9 @@ "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/util.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/async_util.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/file_type.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/metrics_base.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/metrics_events.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/metrics.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/volume_manager_common.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/background/js/app_window_wrapper.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/background/js/background_base.js", diff --git a/ui/file_manager/video_player/manifest.json b/ui/file_manager/video_player/manifest.json index ba25d6b..5e63031 100644 --- a/ui/file_manager/video_player/manifest.json +++ b/ui/file_manager/video_player/manifest.json @@ -65,6 +65,7 @@ "app": { "background": { "scripts": [ + "chrome://resources/js/analytics.js", "chrome://resources/js/cr.js", "chrome://resources/js/cr/event_target.js", "chrome://resources/js/cr/ui/array_data_model.js", @@ -72,6 +73,9 @@ "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/util.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/async_util.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/file_type.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/metrics_base.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/metrics_events.js", + "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/metrics.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/common/js/volume_manager_common.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/background/js/app_window_wrapper.js", "chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/background/js/background_base.js", |