Commit f0782b47 authored by Meilin Wang's avatar Meilin Wang Committed by Chromium LUCI CQ

[Nearby Share] Add metrics: Nearby.Connections.Bluetooth.Adapter.*

This CL adds two histograms:

* Nearby.Connections.Bluetooth.Adapter.SetScanMode.Result,
* Nearby.Connections.Bluetooth.Adapter.SetName.Result

to record the result of a SetScan/SetName request.

Bug: b/163064897
Test: unittested

Change-Id: I6dc62b12f93143f21dacd69eaafe16a0b34fa6ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586244
Commit-Queue: Meilin Wang <meilinw@chromium.org>
Reviewed-by: default avatarRyan Hansberry <hansberry@chromium.org>
Reviewed-by: default avatarCaitlin Fischer <caitlinfischer@google.com>
Cr-Commit-Position: refs/heads/master@{#837807}
parent 6ed14def
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/services/sharing/nearby/platform/bluetooth_adapter.h" #include "chrome/services/sharing/nearby/platform/bluetooth_adapter.h"
#include "base/metrics/histogram_functions.h"
namespace location { namespace location {
namespace nearby { namespace nearby {
...@@ -52,7 +53,11 @@ bool BluetoothAdapter::SetScanMode(BluetoothAdapter::ScanMode scan_mode) { ...@@ -52,7 +53,11 @@ bool BluetoothAdapter::SetScanMode(BluetoothAdapter::ScanMode scan_mode) {
adapter_->SetDiscoverable(scan_mode == ScanMode::kConnectableDiscoverable, adapter_->SetDiscoverable(scan_mode == ScanMode::kConnectableDiscoverable,
&set_discoverable_success); &set_discoverable_success);
return call_success && set_discoverable_success; bool success = call_success && set_discoverable_success;
base::UmaHistogramBoolean(
"Nearby.Connections.Bluetooth.Adapter.SetScanMode.Result", success);
return success;
} }
std::string BluetoothAdapter::GetName() const { std::string BluetoothAdapter::GetName() const {
...@@ -64,7 +69,12 @@ std::string BluetoothAdapter::GetName() const { ...@@ -64,7 +69,12 @@ std::string BluetoothAdapter::GetName() const {
bool BluetoothAdapter::SetName(absl::string_view name) { bool BluetoothAdapter::SetName(absl::string_view name) {
bool set_name_success = false; bool set_name_success = false;
bool call_success = adapter_->SetName(name.data(), &set_name_success); bool call_success = adapter_->SetName(name.data(), &set_name_success);
return call_success && set_name_success;
bool success = call_success && set_name_success;
base::UmaHistogramBoolean(
"Nearby.Connections.Bluetooth.Adapter.SetName.Result", success);
return success;
} }
std::string BluetoothAdapter::GetMacAddress() const { std::string BluetoothAdapter::GetMacAddress() const {
......
...@@ -9443,6 +9443,26 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -9443,6 +9443,26 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary> </summary>
</histogram> </histogram>
<histogram name="Nearby.Connections.Bluetooth.Adapter.SetName.Result"
enum="BooleanSuccess" expires_after="2021-12-16">
<owner>hansberry@chromium.org</owner>
<owner>nearby-share-chromeos-eng@google.com</owner>
<summary>
Records whether the request to set the adapter's name has succeeded. Emitted
when the request succeeds or fails.
</summary>
</histogram>
<histogram name="Nearby.Connections.Bluetooth.Adapter.SetScanMode.Result"
enum="BooleanSuccess" expires_after="2021-12-16">
<owner>hansberry@chromium.org</owner>
<owner>nearby-share-chromeos-eng@google.com</owner>
<summary>
Records whether the request to set the adapter's scan mode has succeeded.
Emitted when the request succeeds or fails.
</summary>
</histogram>
<histogram <histogram
name="Nearby.Connections.Bluetooth.ClassicMedium.ConnectToService.Duration" name="Nearby.Connections.Bluetooth.ClassicMedium.ConnectToService.Duration"
units="ms" expires_after="2021-12-15"> units="ms" expires_after="2021-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