Commit 0c4eb4b9 authored by Anand K. Mistry's avatar Anand K. Mistry Committed by Commit Bot

Record mount and unmount errors to UMA.

BUG=873903

Change-Id: I2682b57782944dd61365d8f1b698aa53a604fb5c
Reviewed-on: https://chromium-review.googlesource.com/1177208
Commit-Queue: Anand Mistry <amistry@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarRobert Kaplow (slow) <rkaplow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584368}
parent 1c02a310
...@@ -175,6 +175,9 @@ MountErrorToMountCompletedStatus(chromeos::MountError error) { ...@@ -175,6 +175,9 @@ MountErrorToMountCompletedStatus(chromeos::MountError error) {
MOUNT_COMPLETED_STATUS_ERROR_UNSUPPORTED_FILESYSTEM; MOUNT_COMPLETED_STATUS_ERROR_UNSUPPORTED_FILESYSTEM;
case chromeos::MOUNT_ERROR_INVALID_ARCHIVE: case chromeos::MOUNT_ERROR_INVALID_ARCHIVE:
return file_manager_private::MOUNT_COMPLETED_STATUS_ERROR_INVALID_ARCHIVE; return file_manager_private::MOUNT_COMPLETED_STATUS_ERROR_INVALID_ARCHIVE;
// Not a real error.
case chromeos::MOUNT_ERROR_COUNT:
NOTREACHED();
} }
NOTREACHED(); NOTREACHED();
return file_manager_private::MOUNT_COMPLETED_STATUS_NONE; return file_manager_private::MOUNT_COMPLETED_STATUS_NONE;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/location.h" #include "base/location.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
...@@ -325,7 +326,11 @@ class CrosDisksClientImpl : public CrosDisksClient { ...@@ -325,7 +326,11 @@ class CrosDisksClientImpl : public CrosDisksClient {
// Handles the result of Unmount and calls |callback| or |error_callback|. // Handles the result of Unmount and calls |callback| or |error_callback|.
void OnUnmount(UnmountCallback callback, dbus::Response* response) { void OnUnmount(UnmountCallback callback, dbus::Response* response) {
const char kUnmountHistogramName[] = "CrosDisksClient.UnmountError";
if (!response) { if (!response) {
UMA_HISTOGRAM_ENUMERATION(kUnmountHistogramName, MOUNT_ERROR_UNKNOWN,
MOUNT_ERROR_COUNT);
std::move(callback).Run(MOUNT_ERROR_UNKNOWN); std::move(callback).Run(MOUNT_ERROR_UNKNOWN);
return; return;
} }
...@@ -345,6 +350,8 @@ class CrosDisksClientImpl : public CrosDisksClient { ...@@ -345,6 +350,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
mount_error = CrosDisksMountErrorToChromeMountError( mount_error = CrosDisksMountErrorToChromeMountError(
static_cast<cros_disks::MountErrorType>(error_code)); static_cast<cros_disks::MountErrorType>(error_code));
} }
UMA_HISTOGRAM_ENUMERATION(kUnmountHistogramName, mount_error,
MOUNT_ERROR_COUNT);
std::move(callback).Run(mount_error); std::move(callback).Run(mount_error);
} }
...@@ -437,6 +444,8 @@ class CrosDisksClientImpl : public CrosDisksClient { ...@@ -437,6 +444,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
return; return;
} }
UMA_HISTOGRAM_ENUMERATION("CrosDisksClient.MountCompletedError",
entry.error_code(), MOUNT_ERROR_COUNT);
for (auto& observer : observer_list_) for (auto& observer : observer_list_)
observer.OnMountCompleted(entry); observer.OnMountCompleted(entry);
} }
......
...@@ -51,6 +51,8 @@ enum DeviceType { ...@@ -51,6 +51,8 @@ enum DeviceType {
// Mount error code used by cros-disks. // Mount error code used by cros-disks.
// These values are not the same as cros_disks::MountErrorType. // These values are not the same as cros_disks::MountErrorType.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum MountError { enum MountError {
MOUNT_ERROR_NONE, MOUNT_ERROR_NONE,
MOUNT_ERROR_UNKNOWN, MOUNT_ERROR_UNKNOWN,
...@@ -69,6 +71,7 @@ enum MountError { ...@@ -69,6 +71,7 @@ enum MountError {
MOUNT_ERROR_UNKNOWN_FILESYSTEM, MOUNT_ERROR_UNKNOWN_FILESYSTEM,
MOUNT_ERROR_UNSUPPORTED_FILESYSTEM, MOUNT_ERROR_UNSUPPORTED_FILESYSTEM,
MOUNT_ERROR_INVALID_ARCHIVE, MOUNT_ERROR_INVALID_ARCHIVE,
MOUNT_ERROR_COUNT,
}; };
// Rename error reported by cros-disks. // Rename error reported by cros-disks.
......
...@@ -8654,6 +8654,26 @@ Called by update_net_error_codes.py.--> ...@@ -8654,6 +8654,26 @@ Called by update_net_error_codes.py.-->
<int value="5" label="Gzip-compressed Tar"/> <int value="5" label="Gzip-compressed Tar"/>
</enum> </enum>
<enum name="CrosDisksClientMountError">
<int value="0" label="Success"/>
<int value="1" label="Unknown"/>
<int value="2" label="Internal"/>
<int value="3" label="Invalid argument"/>
<int value="4" label="Invalid path"/>
<int value="5" label="Path already mounted"/>
<int value="6" label="Path not mounted"/>
<int value="7" label="Directory creation failed"/>
<int value="8" label="Invalid mount options"/>
<int value="9" label="Invalid unmount options"/>
<int value="10" label="Insufficient permissions"/>
<int value="11" label="Mount program not found"/>
<int value="12" label="Mount program failed"/>
<int value="13" label="Invalid device path"/>
<int value="14" label="Unknown filesystem"/>
<int value="15" label="Unsupported filesystem"/>
<int value="16" label="Invalid archive"/>
</enum>
<enum name="CrosDisksDeviceMediaType"> <enum name="CrosDisksDeviceMediaType">
<int value="0" label="Unknown"/> <int value="0" label="Unknown"/>
<int value="1" label="USB Drive"/> <int value="1" label="USB Drive"/>
...@@ -15142,6 +15142,23 @@ uploading your change for review. ...@@ -15142,6 +15142,23 @@ uploading your change for review.
</summary> </summary>
</histogram> </histogram>
<histogram name="CrosDisksClient.MountCompletedError"
enum="CrosDisksClientMountError">
<owner>amistry@chromium.org</owner>
<summary>
The error code of disk mount signals received from the Chrome OS cros-disks
daemon.
</summary>
</histogram>
<histogram name="CrosDisksClient.UnmountError" enum="CrosDisksClientMountError">
<owner>amistry@chromium.org</owner>
<summary>
The error code of disk unmount operations returned from the Chrome OS
cros-disks daemon.
</summary>
</histogram>
<histogram name="CrosFirstRun.DialogShown"> <histogram name="CrosFirstRun.DialogShown">
<owner>alemate@chromium.org</owner> <owner>alemate@chromium.org</owner>
<summary> <summary>
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