Add metrics for session storage
This CL adds two metrics related to session persistence: - Net.DeviceBoundSessions.SessionStoreLoadDuration for how long it takes to load sessions. - Net.DeviceBoundSessions.SessionStoreLoadSuccess for the success rate of loading sessions. Bug: 388557900 Change-Id: I539df8f6e8271fe1f271667d60843fc06b0ad4e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6288998 Reviewed-by: Charlie Harrison <csharrison@chromium.org> Reviewed-by: thefrog <thefrog@chromium.org> Commit-Queue: Daniel Rubery <drubery@chromium.org> Cr-Commit-Position: refs/heads/main@{#1423445}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
c64148d767
commit
4e6f903227
net/device_bound_sessions
tools/metrics/histograms/metadata/net
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "base/metrics/histogram_functions.h"
|
||||||
#include "base/sequence_checker.h"
|
#include "base/sequence_checker.h"
|
||||||
#include "base/task/sequenced_task_runner.h"
|
#include "base/task/sequenced_task_runner.h"
|
||||||
#include "base/task/thread_pool.h"
|
#include "base/task/thread_pool.h"
|
||||||
@ -125,10 +126,12 @@ void SessionStoreImpl::LoadSessions(LoadSessionsCallback callback) {
|
|||||||
db_storage_path_, base::Unretained(table_manager_.get()),
|
db_storage_path_, base::Unretained(table_manager_.get()),
|
||||||
base::Unretained(session_data_.get())),
|
base::Unretained(session_data_.get())),
|
||||||
base::BindOnce(&SessionStoreImpl::OnDatabaseLoaded,
|
base::BindOnce(&SessionStoreImpl::OnDatabaseLoaded,
|
||||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
|
weak_ptr_factory_.GetWeakPtr(), std::move(callback),
|
||||||
|
base::ElapsedTimer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionStoreImpl::OnDatabaseLoaded(LoadSessionsCallback callback,
|
void SessionStoreImpl::OnDatabaseLoaded(LoadSessionsCallback callback,
|
||||||
|
base::ElapsedTimer timer,
|
||||||
DBStatus db_status) {
|
DBStatus db_status) {
|
||||||
db_status_ = db_status;
|
db_status_ = db_status;
|
||||||
SessionsMap sessions;
|
SessionsMap sessions;
|
||||||
@ -140,6 +143,10 @@ void SessionStoreImpl::OnDatabaseLoaded(LoadSessionsCallback callback,
|
|||||||
session_data_->DeleteData(keys_to_delete);
|
session_data_->DeleteData(keys_to_delete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
base::UmaHistogramBoolean("Net.DeviceBoundSessions.SessionStoreLoadSuccess",
|
||||||
|
db_status == DBStatus::kSuccess);
|
||||||
|
base::UmaHistogramTimes("Net.DeviceBoundSessions.SessionStoreLoadDuration",
|
||||||
|
timer.Elapsed());
|
||||||
std::move(callback).Run(std::move(sessions));
|
std::move(callback).Run(std::move(sessions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "base/functional/callback_forward.h"
|
#include "base/functional/callback_forward.h"
|
||||||
#include "base/gtest_prod_util.h"
|
#include "base/gtest_prod_util.h"
|
||||||
#include "base/memory/scoped_refptr.h"
|
#include "base/memory/scoped_refptr.h"
|
||||||
|
#include "base/timer/elapsed_timer.h"
|
||||||
#include "components/sqlite_proto/key_value_data.h"
|
#include "components/sqlite_proto/key_value_data.h"
|
||||||
#include "components/sqlite_proto/key_value_table.h"
|
#include "components/sqlite_proto/key_value_table.h"
|
||||||
#include "components/sqlite_proto/proto_table_manager.h"
|
#include "components/sqlite_proto/proto_table_manager.h"
|
||||||
@ -79,7 +80,9 @@ class NET_EXPORT SessionStoreImpl : public SessionStore {
|
|||||||
FRIEND_TEST_ALL_PREFIXES(SessionStoreImplTest,
|
FRIEND_TEST_ALL_PREFIXES(SessionStoreImplTest,
|
||||||
PruneLoadedEntryWithSessionMissingWrappedKey);
|
PruneLoadedEntryWithSessionMissingWrappedKey);
|
||||||
|
|
||||||
void OnDatabaseLoaded(LoadSessionsCallback callback, DBStatus status);
|
void OnDatabaseLoaded(LoadSessionsCallback callback,
|
||||||
|
base::ElapsedTimer timer,
|
||||||
|
DBStatus status);
|
||||||
|
|
||||||
// Helper function called by `OnDatabaseLoaded` to prune out any invalid
|
// Helper function called by `OnDatabaseLoaded` to prune out any invalid
|
||||||
// entries found in the data loaded from disk. Returns a map of valid
|
// entries found in the data loaded from disk. Returns a map of valid
|
||||||
|
@ -1061,6 +1061,29 @@ chromium-metrics-reviews@google.com.
|
|||||||
</summary>
|
</summary>
|
||||||
</histogram>
|
</histogram>
|
||||||
|
|
||||||
|
<histogram name="Net.DeviceBoundSessions.SessionStoreLoadDuration" units="ms"
|
||||||
|
expires_after="2026-02-18">
|
||||||
|
<owner>drubery@chromium.org</owner>
|
||||||
|
<owner>chrome-counter-abuse-alerts@google.com</owner>
|
||||||
|
<summary>
|
||||||
|
This records how long it took to load Device Bound Sessions
|
||||||
|
(https://github.com/w3c/webappsec-dbsc/blob/main/README.md) persisted to
|
||||||
|
disk. It is logged once at startup, when sessions are loaded.
|
||||||
|
</summary>
|
||||||
|
</histogram>
|
||||||
|
|
||||||
|
<histogram name="Net.DeviceBoundSessions.SessionStoreLoadSuccess"
|
||||||
|
enum="BooleanLoaded" expires_after="2026-02-18">
|
||||||
|
<owner>drubery@chromium.org</owner>
|
||||||
|
<owner>chrome-counter-abuse-alerts@google.com</owner>
|
||||||
|
<summary>
|
||||||
|
This records whether loading existing Device Bound Sessions
|
||||||
|
(https://github.com/w3c/webappsec-dbsc/blob/main/README.md) that were
|
||||||
|
persisted to disk succeeded. It is logged once at startup, when sessions are
|
||||||
|
loaded.
|
||||||
|
</summary>
|
||||||
|
</histogram>
|
||||||
|
|
||||||
<histogram name="Net.DeviceBoundSessions.TotalRequestDeferredDuration"
|
<histogram name="Net.DeviceBoundSessions.TotalRequestDeferredDuration"
|
||||||
units="ms" expires_after="2026-02-18">
|
units="ms" expires_after="2026-02-18">
|
||||||
<owner>drubery@chromium.org</owner>
|
<owner>drubery@chromium.org</owner>
|
||||||
|
Reference in New Issue
Block a user