Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Unified Diff: content/browser/indexed_db/indexed_db_transaction.cc

Issue 2903133002: [IndexedDB] Adding uma for transaction aborts (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/enums.xml » ('j') | tools/metrics/histograms/enums.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/indexed_db_transaction.cc
diff --git a/content/browser/indexed_db/indexed_db_transaction.cc b/content/browser/indexed_db/indexed_db_transaction.cc
index 904a284651a5220be85d53d13c6958292ac8756c..1921cd609025985b021849f21f9183a915378fb5 100644
--- a/content/browser/indexed_db/indexed_db_transaction.cc
+++ b/content/browser/indexed_db/indexed_db_transaction.cc
@@ -8,6 +8,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "base/metrics/histogram_macros.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -36,6 +37,41 @@ void CommitUnused(base::WeakPtr<IndexedDBTransaction> transaction) {
DCHECK(status.ok());
}
+// Used for UMA metrics - do not change values.
+enum UmaIDBException {
+ UmaIDBExceptionUnknownError = 0,
+ UmaIDBExceptionConstraintError,
jsbell 2017/05/25 17:08:58 Give all of these explicit values since they are u
dmurph 2017/05/25 17:33:08 Done.
+ UmaIDBExceptionDataError,
+ UmaIDBExceptionVersionError,
+ UmaIDBExceptionAbortError,
+ UmaIDBExceptionQuotaError,
+ UmaIDBExceptionTimeoutError,
+ UmaIDBExceptionExclusiveMaxValue
+};
+
+// Used for UMA metrics - do not change mappings.
+UmaIDBException TranslateExceptionCodeToUmaEnum(uint16_t code) {
jsbell 2017/05/25 17:08:58 Could drop 'Translate' from the name here, but it'
dmurph 2017/05/25 17:33:08 Done.
+ switch (code) {
+ case blink::kWebIDBDatabaseExceptionUnknownError:
+ return UmaIDBExceptionUnknownError;
+ case blink::kWebIDBDatabaseExceptionConstraintError:
+ return UmaIDBExceptionConstraintError;
+ case blink::kWebIDBDatabaseExceptionDataError:
+ return UmaIDBExceptionDataError;
+ case blink::kWebIDBDatabaseExceptionVersionError:
+ return UmaIDBExceptionVersionError;
+ case blink::kWebIDBDatabaseExceptionAbortError:
+ return UmaIDBExceptionAbortError;
+ case blink::kWebIDBDatabaseExceptionQuotaError:
+ return UmaIDBExceptionQuotaError;
+ case blink::kWebIDBDatabaseExceptionTimeoutError:
+ return UmaIDBExceptionTimeoutError;
+ default:
+ NOTREACHED();
+ }
+ return UmaIDBExceptionUnknownError;
+}
+
} // namespace
IndexedDBTransaction::TaskQueue::TaskQueue() {}
@@ -152,6 +188,10 @@ void IndexedDBTransaction::Abort(const IndexedDBDatabaseError& error) {
if (state_ == FINISHED)
return;
+ UMA_HISTOGRAM_ENUMERATION("WebCore.IndexedDB.TransactionAbortReason",
+ TranslateExceptionCodeToUmaEnum(error.code()),
+ UmaIDBExceptionExclusiveMaxValue);
+
timeout_timer_.Stop();
state_ = FINISHED;
« no previous file with comments | « no previous file | tools/metrics/histograms/enums.xml » ('j') | tools/metrics/histograms/enums.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698