Commit d1c11eca authored by Josh Nohle's avatar Josh Nohle Committed by Commit Bot

[DeviceSync v2] Add metrics to CryptAuth device notifier

Bug: 951969, 936273
Change-Id: I8c58888157ecc7d715d10ab1053cb0439e69d275
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986260Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Auto-Submit: Josh Nohle <nohle@chromium.org>
Commit-Queue: Josh Nohle <nohle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732532}
parent 2e624668
......@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "chromeos/components/multidevice/logging/logging.h"
#include "chromeos/services/device_sync/async_execution_time_metrics_logger.h"
......@@ -34,14 +35,25 @@ constexpr base::TimeDelta kWaitingForBatchNotifyGroupDevicesResponseTimeout =
void RecordClientAppMetadataFetchMetrics(const base::TimeDelta& execution_time,
CryptAuthAsyncTaskResult result) {
// TODO(https://crbug.com/933656, https://crbug.com/936273): Add metrics to
// track async execution times and failure rates due to async timeouts.
base::UmaHistogramCustomTimes(
"CryptAuth.DeviceSyncV2.DeviceNotifier.ExecutionTime."
"ClientAppMetadataFetch",
execution_time, base::TimeDelta::FromSeconds(1) /* min */,
kWaitingForClientAppMetadataTimeout /* max */, 100 /* buckets */);
LogCryptAuthAsyncTaskSuccessMetric(
"CryptAuth.DeviceSyncV2.DeviceNotifier.AsyncTaskResult."
"ClientAppMetadataFetch",
result);
}
void RecordBatchNotifyGroupDevicesMetrics(const base::TimeDelta& execution_time,
CryptAuthApiCallResult result) {
// TODO(https://crbug.com/933656, https://crbug.com/936273): Add metrics to
// track async execution times and failure rates due to async timeouts.
LogAsyncExecutionTimeMetric(
"CryptAuth.DeviceSyncV2.DeviceNotifier.ExecutionTime.NotifyGroupDevices",
execution_time);
LogCryptAuthApiCallSuccessMetric(
"CryptAuth.DeviceSyncV2.DeviceNotifier.ApiCallResult.NotifyGroupDevices",
result);
}
} // namespace
......@@ -252,14 +264,24 @@ void CryptAuthDeviceNotifierImpl::OnClientAppMetadataFetched(
void CryptAuthDeviceNotifierImpl::OnBatchNotifyGroupDevicesSuccess(
const cryptauthv2::BatchNotifyGroupDevicesResponse& response) {
DCHECK_EQ(State::kWaitingForBatchNotifyGroupDevicesResponse, state_);
RecordBatchNotifyGroupDevicesMetrics(
base::TimeTicks::Now() - last_state_change_timestamp_,
CryptAuthApiCallResult::kSuccess);
FinishAttempt(base::nullopt /* error */);
}
void CryptAuthDeviceNotifierImpl::OnBatchNotifyGroupDevicesFailure(
NetworkRequestError error) {
DCHECK_EQ(State::kWaitingForBatchNotifyGroupDevicesResponse, state_);
RecordBatchNotifyGroupDevicesMetrics(
base::TimeTicks::Now() - last_state_change_timestamp_,
CryptAuthApiCallResultFromNetworkRequestError(error));
PA_LOG(ERROR) << "BatchNotifyGroupDevices call failed with error " << error
<< ".";
FinishAttempt(error);
}
......
......@@ -29190,6 +29190,54 @@ uploading your change for review.
</summary>
</histogram>
<histogram
name="CryptAuth.DeviceSyncV2.DeviceNotifier.ApiCallResult.NotifyGroupDevices"
enum="CryptAuthApiCallResult" expires_after="2020-12-15">
<owner>nohle@chromium.org</owner>
<owner>better-together-dev@google.com</owner>
<summary>
Records the result of the async BatchNotifyGroupDevices API call to
CryptAuth. Recorded when the async callback is invoked or when the call
times out.
</summary>
</histogram>
<histogram
name="CryptAuth.DeviceSyncV2.DeviceNotifier.AsyncTaskResult.ClientAppMetadataFetch"
enum="CryptAuthAsyncTaskResult" expires_after="2020-12-15">
<owner>nohle@chromium.org</owner>
<owner>better-together-dev@google.com</owner>
<summary>
Records the result of the async ClientAppMetadata retrieval for the
CryptAuth device notifier. Recorded when the async callback is invoked or
when the call times out.
</summary>
</histogram>
<histogram
name="CryptAuth.DeviceSyncV2.DeviceNotifier.ExecutionTime.ClientAppMetadataFetch"
units="ms" expires_after="2020-12-15">
<owner>nohle@chromium.org</owner>
<owner>better-together-dev@google.com</owner>
<summary>
Records the execution time of the async ClientAppMetadata retrieval for the
CryptAuth device notifier. Recorded when the async callback is invoked or
when the call times out.
</summary>
</histogram>
<histogram
name="CryptAuth.DeviceSyncV2.DeviceNotifier.ExecutionTime.NotifyGroupDevices"
units="ms" expires_after="2020-12-15">
<owner>nohle@chromium.org</owner>
<owner>better-together-dev@google.com</owner>
<summary>
Records the execution time of the async BatchNotifyGroupDevices API call to
CryptAuth. Recorded when the async callback is invoked or when the call
times out.
</summary>
</histogram>
<histogram
name="CryptAuth.DeviceSyncV2.DeviceSyncer.ExecutionTime.GroupPrivateKeyDecryption"
units="ms" expires_after="2020-12-15">
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