Commit f712e487 authored by Gavin Williams's avatar Gavin Williams Committed by Chromium LUCI CQ

scanning: Create metric to track scan job success rate

Create metric to track the scan job success rate of scans initiated from
the Scan app. This metric will not include canceled scans.

Bug: 1059779
Change-Id: I5487f643169fcffdfb7c50b074daed19bcd14d5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2583211Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarJesse Schettler <jschettler@chromium.org>
Commit-Queue: Gavin Williams <gavinwill@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836168}
parent 3d4397ee
......@@ -12,6 +12,7 @@
#include "base/check.h"
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
......@@ -214,6 +215,11 @@ base::FilePath SavePage(const base::FilePath& scan_to_path,
return scan_to_path.Append(filename);
}
// Records the histogram for scan job success.
void RecordScanJobResult(bool success) {
base::UmaHistogramBoolean("Scanning.ScanJobSuccessful", success);
}
} // namespace
ScanService::ScanService(LorgnetteScannerManager* lorgnette_scanner_manager,
......@@ -259,6 +265,7 @@ void ScanService::StartScan(
const std::string scanner_name = GetScannerName(scanner_id);
if (scanner_name.empty() || !FilePathSupported(settings->scan_to_path)) {
std::move(callback).Run(false);
RecordScanJobResult(false);
return;
}
......@@ -394,6 +401,7 @@ void ScanService::OnAllPagesSaved(bool success) {
last_scanned_file_path_.clear();
scan_job_observer_->OnScanComplete(!save_failed_, last_scanned_file_path_);
RecordScanJobResult(!save_failed_);
}
bool ScanService::FilePathSupported(const base::FilePath& file_path) {
......
......@@ -31,6 +31,17 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>
<histogram name="Scanning.ScanJobSuccessful" enum="Boolean"
expires_after="2021-12-04">
<owner>gavinwill@chromium.org</owner>
<owner>cros-peripherals@google.com</owner>
<summary>
Records true if the attempted scan job completed successfully and false if
the scan job failed for any reason. This metric will not include canceled
scan jobs.
</summary>
</histogram>
</histograms>
</histogram-configuration>
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