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

[CrOS PhoneHub] Rename histogram.

Renames "PhoneHub.Connectivity.Success" to "PhoneHub.Connection.Result"
according to the metrics doc.

Bug: 1150634
Change-Id: I33cb9ab52c7d0011fb81fdfd98eef2ec7ee30876
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2559616
Commit-Queue: Meilin Wang <meilinw@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Reviewed-by: default avatarRegan Hsu <hsuregan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832108}
parent 073d5574
...@@ -20,7 +20,7 @@ constexpr base::TimeDelta kConnectionTimeoutSeconds( ...@@ -20,7 +20,7 @@ constexpr base::TimeDelta kConnectionTimeoutSeconds(
base::TimeDelta::FromSeconds(15u)); base::TimeDelta::FromSeconds(15u));
void RecordConnectionSuccessMetric(bool success) { void RecordConnectionSuccessMetric(bool success) {
UMA_HISTOGRAM_BOOLEAN("PhoneHub.Connectivity.Success", success); UMA_HISTOGRAM_BOOLEAN("PhoneHub.Connection.Result", success);
} }
} // namespace } // namespace
......
...@@ -139,6 +139,13 @@ class ConnectionManagerImplTest : public testing::Test { ...@@ -139,6 +139,13 @@ class ConnectionManagerImplTest : public testing::Test {
mock_timer_->Fire(); mock_timer_->Fire();
} }
void VerifyConnectionResultHistogram(
base::HistogramBase::Sample sample,
base::HistogramBase::Count expected_count) {
histogram_tester_.ExpectBucketCount("PhoneHub.Connection.Result", sample,
expected_count);
}
base::MockOneShotTimer* mock_timer_; base::MockOneShotTimer* mock_timer_;
chromeos::multidevice::RemoteDeviceRef test_remote_device_; chromeos::multidevice::RemoteDeviceRef test_remote_device_;
chromeos::multidevice::RemoteDeviceRef test_local_device_; chromeos::multidevice::RemoteDeviceRef test_local_device_;
...@@ -175,7 +182,7 @@ TEST_F(ConnectionManagerImplTest, SuccessfullyAttemptConnection) { ...@@ -175,7 +182,7 @@ TEST_F(ConnectionManagerImplTest, SuccessfullyAttemptConnection) {
histogram_tester_.ExpectTimeBucketCount("PhoneHub.Connectivity.Latency", histogram_tester_.ExpectTimeBucketCount("PhoneHub.Connectivity.Latency",
kFakeConnectionLatencyTime, 1); kFakeConnectionLatencyTime, 1);
histogram_tester_.ExpectBucketCount("PhoneHub.Connectivity.Success", true, 1); VerifyConnectionResultHistogram(true, 1);
} }
TEST_F(ConnectionManagerImplTest, FailedToAttemptConnection) { TEST_F(ConnectionManagerImplTest, FailedToAttemptConnection) {
...@@ -196,8 +203,7 @@ TEST_F(ConnectionManagerImplTest, FailedToAttemptConnection) { ...@@ -196,8 +203,7 @@ TEST_F(ConnectionManagerImplTest, FailedToAttemptConnection) {
EXPECT_EQ(2u, GetNumStatusObserverCalls()); EXPECT_EQ(2u, GetNumStatusObserverCalls());
EXPECT_EQ(ConnectionManager::Status::kDisconnected, GetStatus()); EXPECT_EQ(ConnectionManager::Status::kDisconnected, GetStatus());
histogram_tester_.ExpectBucketCount("PhoneHub.Connectivity.Success", false, VerifyConnectionResultHistogram(false, 1);
1);
} }
TEST_F(ConnectionManagerImplTest, SuccessfulAttemptConnectionButDisconnected) { TEST_F(ConnectionManagerImplTest, SuccessfulAttemptConnectionButDisconnected) {
...@@ -224,7 +230,7 @@ TEST_F(ConnectionManagerImplTest, SuccessfulAttemptConnectionButDisconnected) { ...@@ -224,7 +230,7 @@ TEST_F(ConnectionManagerImplTest, SuccessfulAttemptConnectionButDisconnected) {
histogram_tester_.ExpectTimeBucketCount("PhoneHub.Connectivity.Latency", histogram_tester_.ExpectTimeBucketCount("PhoneHub.Connectivity.Latency",
kFakeConnectionLatencyTime, 1); kFakeConnectionLatencyTime, 1);
histogram_tester_.ExpectBucketCount("PhoneHub.Connectivity.Success", true, 1); VerifyConnectionResultHistogram(true, 1);
// Simulate a disconnected channel. // Simulate a disconnected channel.
test_clock_->Advance(kFakeConnectionDurationTime); test_clock_->Advance(kFakeConnectionDurationTime);
...@@ -257,7 +263,7 @@ TEST_F(ConnectionManagerImplTest, AttemptConnectionWithMessageReceived) { ...@@ -257,7 +263,7 @@ TEST_F(ConnectionManagerImplTest, AttemptConnectionWithMessageReceived) {
histogram_tester_.ExpectTimeBucketCount("PhoneHub.Connectivity.Latency", histogram_tester_.ExpectTimeBucketCount("PhoneHub.Connectivity.Latency",
kFakeConnectionLatencyTime, 1); kFakeConnectionLatencyTime, 1);
histogram_tester_.ExpectBucketCount("PhoneHub.Connectivity.Success", true, 1); VerifyConnectionResultHistogram(true, 1);
// Status has been updated to connected, verify that the status observer has // Status has been updated to connected, verify that the status observer has
// been called. // been called.
...@@ -318,7 +324,7 @@ TEST_F(ConnectionManagerImplTest, SuccessfullyAttemptConnectionWithBle) { ...@@ -318,7 +324,7 @@ TEST_F(ConnectionManagerImplTest, SuccessfullyAttemptConnectionWithBle) {
histogram_tester_.ExpectTimeBucketCount("PhoneHub.Connectivity.Latency", histogram_tester_.ExpectTimeBucketCount("PhoneHub.Connectivity.Latency",
kFakeConnectionLatencyTime, 1); kFakeConnectionLatencyTime, 1);
histogram_tester_.ExpectBucketCount("PhoneHub.Connectivity.Success", true, 1); VerifyConnectionResultHistogram(true, 1);
// Status has been updated to connected, verify that the status observer has // Status has been updated to connected, verify that the status observer has
// been called. // been called.
...@@ -342,8 +348,7 @@ TEST_F(ConnectionManagerImplTest, ConnectionTimeout) { ...@@ -342,8 +348,7 @@ TEST_F(ConnectionManagerImplTest, ConnectionTimeout) {
VerifyTimerStopped(); VerifyTimerStopped();
EXPECT_EQ(2u, GetNumStatusObserverCalls()); EXPECT_EQ(2u, GetNumStatusObserverCalls());
EXPECT_EQ(ConnectionManager::Status::kDisconnected, GetStatus()); EXPECT_EQ(ConnectionManager::Status::kDisconnected, GetStatus());
histogram_tester_.ExpectBucketCount("PhoneHub.Connectivity.Success", false, VerifyConnectionResultHistogram(false, 1);
1);
} }
TEST_F(ConnectionManagerImplTest, DisconnectConnection) { TEST_F(ConnectionManagerImplTest, DisconnectConnection) {
...@@ -361,8 +366,7 @@ TEST_F(ConnectionManagerImplTest, DisconnectConnection) { ...@@ -361,8 +366,7 @@ TEST_F(ConnectionManagerImplTest, DisconnectConnection) {
EXPECT_EQ(2u, GetNumStatusObserverCalls()); EXPECT_EQ(2u, GetNumStatusObserverCalls());
EXPECT_EQ(ConnectionManager::Status::kDisconnected, GetStatus()); EXPECT_EQ(ConnectionManager::Status::kDisconnected, GetStatus());
VerifyTimerStopped(); VerifyTimerStopped();
histogram_tester_.ExpectBucketCount("PhoneHub.Connectivity.Success", false, VerifyConnectionResultHistogram(false, 1);
1);
} }
} // namespace phonehub } // namespace phonehub
......
...@@ -39,6 +39,16 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -39,6 +39,16 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<summary>The steady state feature status of PhoneHub on user login.</summary> <summary>The steady state feature status of PhoneHub on user login.</summary>
</histogram> </histogram>
<histogram name="PhoneHub.Connection.Result" enum="BooleanSuccess"
expires_after="2021-11-30">
<owner>khorimoto@chromium.org</owner>
<owner>better-together-dev@google.com</owner>
<summary>
Measures PhoneHub connection success rate, considering attempts where the
phone is not nearby as failures.
</summary>
</histogram>
<histogram name="PhoneHub.Connectivity.Duration" units="ms" expires_after="M98"> <histogram name="PhoneHub.Connectivity.Duration" units="ms" expires_after="M98">
<owner>khorimoto@chromium.org</owner> <owner>khorimoto@chromium.org</owner>
<owner>better-together-dev@google.com</owner> <owner>better-together-dev@google.com</owner>
...@@ -59,6 +69,9 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -59,6 +69,9 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<histogram name="PhoneHub.Connectivity.Success" enum="BooleanSuccess" <histogram name="PhoneHub.Connectivity.Success" enum="BooleanSuccess"
expires_after="M98"> expires_after="M98">
<obsolete>
Renamed to PhoneHub.Connection.Result on 11/2020 in M89.
</obsolete>
<owner>khorimoto@chromium.org</owner> <owner>khorimoto@chromium.org</owner>
<owner>better-together-dev@google.com</owner> <owner>better-together-dev@google.com</owner>
<summary>The success rate of connecting to the Phone.</summary> <summary>The success rate of connecting to the Phone.</summary>
......
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