0

[Fast Pair] Log results of get, post, and delete in Footprints.

Adds metrics to log the results of get, post, and delete requests in
the FootprintsFetcher.

Change-Id: I3f91d5850cb67821cd88d71f7e1b76d176822f4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3342153
Reviewed-by: Shane Fitzpatrick <shanefitz@google.com>
Reviewed-by: Josh Nohle <nohle@chromium.org>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Jon Mann <jonmann@chromium.org>
Commit-Queue: Juliet Levesque <julietlevesque@google.com>
Cr-Commit-Position: refs/heads/main@{#956546}
This commit is contained in:
Juliet Levesque
2022-01-07 16:56:48 +00:00
committed by Chromium LUCI CQ
parent 18bd68b22c
commit fc27b77efd
4 changed files with 72 additions and 0 deletions
ash/quick_pair
tools/metrics/histograms/metadata/bluetooth

@ -140,6 +140,12 @@ const char kMessageStreamConnectToServiceTime[] =
"TotalConnectTime";
const char kDeviceMetadataFetchResult[] =
"Bluetooth.ChromeOS.FastPair.DeviceMetadataFetcher.Result";
const char kFootprintsFetcherDeleteResult[] =
"Bluetooth.ChromeOS.FastPair.FootprintsFetcher.Delete.Result";
const char kFootprintsFetcherPostResult[] =
"Bluetooth.ChromeOS.FastPair.FootprintsFetcher.Post.Result";
const char kFootprintsFetcherGetResult[] =
"Bluetooth.ChromeOS.FastPair.FootprintsFetcher.Get.Result";
} // namespace
@ -385,5 +391,17 @@ void RecordDeviceMetadataFetchResult(bool success) {
base::UmaHistogramBoolean(kDeviceMetadataFetchResult, success);
}
void RecordFootprintsFetcherDeleteResult(bool success) {
base::UmaHistogramBoolean(kFootprintsFetcherDeleteResult, success);
}
void RecordFootprintsFetcherPostResult(bool success) {
base::UmaHistogramBoolean(kFootprintsFetcherPostResult, success);
}
void RecordFootprintsFetcherGetResult(bool success) {
base::UmaHistogramBoolean(kFootprintsFetcherGetResult, success);
}
} // namespace quick_pair
} // namespace ash

@ -179,6 +179,15 @@ void RecordMessageStreamConnectToServiceTime(
COMPONENT_EXPORT(QUICK_PAIR_COMMON)
void RecordDeviceMetadataFetchResult(bool success);
COMPONENT_EXPORT(QUICK_PAIR_COMMON)
void RecordFootprintsFetcherDeleteResult(bool success);
COMPONENT_EXPORT(QUICK_PAIR_COMMON)
void RecordFootprintsFetcherPostResult(bool success);
COMPONENT_EXPORT(QUICK_PAIR_COMMON)
void RecordFootprintsFetcherGetResult(bool success);
} // namespace quick_pair
} // namespace ash

@ -4,6 +4,7 @@
#include "ash/quick_pair/repository/fast_pair/footprints_fetcher.h"
#include "ash/quick_pair/common/fast_pair/fast_pair_metrics.h"
#include "ash/quick_pair/common/logging.h"
#include "ash/quick_pair/proto/fastpair.pb.h"
#include "ash/quick_pair/proto/fastpair_data.pb.h"
@ -89,6 +90,7 @@ void FootprintsFetcher::OnGetComplete(
if (!response_body) {
QP_LOG(WARNING) << __func__ << ": No response.";
RecordFootprintsFetcherGetResult(/*success=*/false);
std::move(callback).Run(absl::nullopt);
return;
}
@ -96,10 +98,12 @@ void FootprintsFetcher::OnGetComplete(
nearby::fastpair::UserReadDevicesResponse devices;
if (!devices.ParseFromString(*response_body)) {
QP_LOG(WARNING) << __func__ << ": Failed to parse.";
RecordFootprintsFetcherGetResult(/*success=*/false);
std::move(callback).Run(absl::nullopt);
return;
}
RecordFootprintsFetcherGetResult(/*success=*/true);
QP_LOG(VERBOSE)
<< __func__
<< ": Successfully retrived footprints data. Paired devices:";
@ -131,6 +135,7 @@ void FootprintsFetcher::OnPostComplete(
std::unique_ptr<HttpFetcher> http_fetcher,
std::unique_ptr<std::string> response_body) {
QP_LOG(VERBOSE) << __func__;
RecordFootprintsFetcherPostResult(/*success=*/response_body ? true : false);
if (!response_body) {
QP_LOG(WARNING) << __func__ << ": No response.";
@ -158,6 +163,7 @@ void FootprintsFetcher::OnDeleteComplete(
std::unique_ptr<HttpFetcher> http_fetcher,
std::unique_ptr<std::string> response_body) {
QP_LOG(VERBOSE) << __func__;
RecordFootprintsFetcherDeleteResult(/*success=*/response_body ? true : false);
if (!response_body) {
QP_LOG(WARNING) << __func__ << ": No response.";

@ -383,6 +383,45 @@ chromium-metrics-reviews@google.com.
</summary>
</histogram>
<histogram name="Bluetooth.ChromeOS.FastPair.FootprintsFetcher.Delete.Result"
enum="BooleanSuccess" expires_after="2022-09-20">
<owner>shanefitz@google.com</owner>
<owner>julietlevesque@google.com</owner>
<owner>chromeos-cross-device-eng@google.com</owner>
<summary>
Records the success or failure of a Delete request in the FootprintsFetcher.
A failure is considered no response from the server. A success is considered
a response that is able to be parsed. Emitted when the HTTP response is
received from the Footprints server.
</summary>
</histogram>
<histogram name="Bluetooth.ChromeOS.FastPair.FootprintsFetcher.Get.Result"
enum="BooleanSuccess" expires_after="2022-09-20">
<owner>shanefitz@google.com</owner>
<owner>julietlevesque@google.com</owner>
<owner>chromeos-cross-device-eng@google.com</owner>
<summary>
Records the success or failure of a Get request in the FootprintsFetcher. A
failure is considered either no response, or a response that is unable to be
parsed. A success is considered a response that is able to be parsed.
Emitted when the HTTP response is received from the Footprints server.
</summary>
</histogram>
<histogram name="Bluetooth.ChromeOS.FastPair.FootprintsFetcher.Post.Result"
enum="BooleanSuccess" expires_after="2022-09-20">
<owner>shanefitz@google.com</owner>
<owner>julietlevesque@google.com</owner>
<owner>chromeos-cross-device-eng@google.com</owner>
<summary>
Records the success or failure of a Post request in the FootprintsFetcher. A
failure is considered no response from the server. A success is considered a
response that is able to be parsed. Emitted when the HTTP response is
received from the Footprints server.
</summary>
</histogram>
<histogram name="Bluetooth.ChromeOS.FastPair.GattConnection.ErrorReason"
enum="BluetoothDeviceConnectErrorCode" expires_after="2022-09-20">
<owner>shanefitz@google.com</owner>