Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions components/services/storage/dom_storage/local_storage_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,11 @@ void LocalStorageImpl::OnDatabaseOpened(leveldb::Status status) {
if (!status.ok()) {
// If we failed to open the database, try to delete and recreate the
// database, or ultimately fallback to an in-memory database.
#if BUILDFLAG(IS_COBALT)
base::UmaHistogramEnumeration("Cobalt.LocalStorage.DatabaseOpenError",
leveldb_env::GetLevelDBStatusUMAValue(status),
leveldb_env::LEVELDB_STATUS_MAX);
#endif
DeleteAndRecreateDatabase();
return;
}
Expand Down Expand Up @@ -708,13 +713,23 @@ void LocalStorageImpl::OnGotDatabaseVersion(leveldb::Status status,
&db_version) ||
db_version < kMinSchemaVersion ||
db_version > kCurrentLocalStorageSchemaVersion) {
#if BUILDFLAG(IS_COBALT)
base::UmaHistogramEnumeration("Cobalt.LocalStorage.DatabaseVersionMismatch",
leveldb_env::GetLevelDBStatusUMAValue(status),
leveldb_env::LEVELDB_STATUS_MAX);
#endif
DeleteAndRecreateDatabase();
return;
}

database_initialized_ = true;
} else {
// Other read error. Possibly database corruption.
#if BUILDFLAG(IS_COBALT)
base::UmaHistogramEnumeration("Cobalt.LocalStorage.DatabaseReadError",
leveldb_env::GetLevelDBStatusUMAValue(status),
leveldb_env::LEVELDB_STATUS_MAX);
#endif
DeleteAndRecreateDatabase();
return;
}
Expand Down Expand Up @@ -971,6 +986,11 @@ void LocalStorageImpl::OnCommitResult(leveldb::Status status) {
// Deleting StorageAreas in here could cause more commits (and commit
// errors), but those commits won't reach OnCommitResult because the area
// will have been deleted before the commit finishes.
#if BUILDFLAG(IS_COBALT)
base::UmaHistogramEnumeration("Cobalt.LocalStorage.DatabaseCommitError",
leveldb_env::GetLevelDBStatusUMAValue(status),
leveldb_env::LEVELDB_STATUS_MAX);
#endif
DeleteAndRecreateDatabase();
}
}
Expand Down
33 changes: 33 additions & 0 deletions tools/metrics/histograms/metadata/cobalt/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,30 @@ Always run the pretty print utility on this file after editing:
</summary>
</histogram>

<histogram name="Cobalt.LocalStorage.DatabaseCommitError" enum="LevelDBStatus"
expires_after="never">
<owner>colinliang@google.com</owner>
<summary>
Records the leveldb error when a commit fails in Local Storage.
</summary>
</histogram>

<histogram name="Cobalt.LocalStorage.DatabaseOpenError" enum="LevelDBStatus"
expires_after="never">
<owner>colinliang@google.com</owner>
<summary>
Records the leveldb error when opening the Local Storage database fails.
</summary>
</histogram>

<histogram name="Cobalt.LocalStorage.DatabaseReadError" enum="LevelDBStatus"
expires_after="never">
<owner>colinliang@google.com</owner>
<summary>
Records the leveldb error when a read fails in Local Storage.
</summary>
</histogram>

<histogram name="Cobalt.LocalStorage.DatabaseResetReason"
enum="LocalStorageDatabaseResetReason" expires_after="never">
<owner>charleykim@google.com</owner>
Expand All @@ -89,6 +113,15 @@ Always run the pretty print utility on this file after editing:
</summary>
</histogram>

<histogram name="Cobalt.LocalStorage.DatabaseVersionMismatch" enum="LevelDBStatus"
expires_after="never">
<owner>colinliang@google.com</owner>
<summary>
Records the leveldb status when a version mismatch is detected in Local
Storage.
</summary>
</histogram>

<histogram name="Cobalt.Network.CumulativePlatformErrorRaised" units="count"
expires_after="never">
<owner>charleykim@google.com</owner>
Expand Down
Loading