[CrOS PhoneHub] Add metrics for message transfer in SecureChannel.
Add MultiDevice.SecureChannel.Nearby.MessageAction Bug: 1106937, 1150634 Change-Id: I91bc2801c9e35b8b041b4d4c39780ed4d9f32e53 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2569117 Commit-Queue: Andre Le <leandre@chromium.org> Reviewed-by: Robert Kaplow <rkaplow@chromium.org> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#833773}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
7418bc3287
commit
a1f0357eb4
chrome/browser/chromeos
tools/metrics/histograms
@ -2661,6 +2661,8 @@ source_set("chromeos") {
|
||||
"secure_channel/nearby_endpoint_finder_impl.h",
|
||||
"secure_channel/secure_channel_client_provider.cc",
|
||||
"secure_channel/secure_channel_client_provider.h",
|
||||
"secure_channel/util/histogram_util.cc",
|
||||
"secure_channel/util/histogram_util.h",
|
||||
"service_sandbox_type.h",
|
||||
"session_length_limiter.cc",
|
||||
"session_length_limiter.h",
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/rand_util.h"
|
||||
#include "chrome/browser/chromeos/secure_channel/nearby_endpoint_finder.h"
|
||||
#include "chrome/browser/chromeos/secure_channel/util/histogram_util.h"
|
||||
#include "chromeos/components/multidevice/logging/logging.h"
|
||||
|
||||
namespace chromeos {
|
||||
@ -264,6 +265,8 @@ void NearbyConnectionBrokerImpl::SendMessage(const std::string& message,
|
||||
BytesPayload::New(message_as_bytes))),
|
||||
base::BindOnce(&NearbyConnectionBrokerImpl::OnSendPayloadResult,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
|
||||
|
||||
util::LogMessageAction(util::MessageAction::kMessageSent);
|
||||
}
|
||||
|
||||
void NearbyConnectionBrokerImpl::OnConnectionInitiated(
|
||||
@ -363,6 +366,8 @@ void NearbyConnectionBrokerImpl::OnPayloadReceived(
|
||||
payload->content->get_bytes()->bytes;
|
||||
NotifyMessageReceived(
|
||||
std::string(message_as_bytes.begin(), message_as_bytes.end()));
|
||||
|
||||
util::LogMessageAction(util::MessageAction::kMessageReceived);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream,
|
||||
|
@ -0,0 +1,20 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/browser/chromeos/secure_channel/util/histogram_util.h"
|
||||
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
|
||||
namespace chromeos {
|
||||
namespace secure_channel {
|
||||
namespace util {
|
||||
|
||||
void LogMessageAction(MessageAction message_action) {
|
||||
base::UmaHistogramEnumeration(
|
||||
"MultiDevice.SecureChannel.Nearby.MessageAction", message_action);
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace secure_channel
|
||||
} // namespace chromeos
|
29
chrome/browser/chromeos/secure_channel/util/histogram_util.h
Normal file
29
chrome/browser/chromeos/secure_channel/util/histogram_util.h
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright 2020 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_CHROMEOS_SECURE_CHANNEL_UTIL_HISTOGRAM_UTIL_H_
|
||||
#define CHROME_BROWSER_CHROMEOS_SECURE_CHANNEL_UTIL_HISTOGRAM_UTIL_H_
|
||||
|
||||
namespace chromeos {
|
||||
namespace secure_channel {
|
||||
namespace util {
|
||||
|
||||
// Enumeration of possible message transfer action via Nearby Connection
|
||||
// library. Keep in sync with corresponding enum in
|
||||
// tools/metrics/histograms/enums.xml. These values are persisted to logs.
|
||||
// Entries should not be renumbered and numeric values should never be reused.
|
||||
enum class MessageAction {
|
||||
kMessageSent = 0,
|
||||
kMessageReceived = 1,
|
||||
kMaxValue = kMessageReceived,
|
||||
};
|
||||
|
||||
// Logs a given message transfer action.
|
||||
void LogMessageAction(MessageAction message_action);
|
||||
|
||||
} // namespace util
|
||||
} // namespace secure_channel
|
||||
} // namespace chromeos
|
||||
|
||||
#endif // CHROME_BROWSER_CHROMEOS_SECURE_CHANNEL_UTIL_HISTOGRAM_UTIL_H_
|
@ -49789,6 +49789,11 @@ Called by update_use_counter_css.py.-->
|
||||
<int value="1" label="Completed Setup"/>
|
||||
</enum>
|
||||
|
||||
<enum name="MultiDeviceNearbyMessageAction">
|
||||
<int value="0" label="Message Sent"/>
|
||||
<int value="1" label="Message Received"/>
|
||||
</enum>
|
||||
|
||||
<enum name="MultiDeviceSetupNotification">
|
||||
<int value="0" label="New user, potential host exists"/>
|
||||
<int value="1" label="Existing user, host switched"/>
|
||||
|
@ -248,6 +248,17 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
|
||||
</summary>
|
||||
</histogram>
|
||||
|
||||
<histogram name="MultiDevice.SecureChannel.Nearby.MessageAction"
|
||||
enum="MultiDeviceNearbyMessageAction" expires_after="2021-11-30">
|
||||
<owner>khorimoto@chromium.org</owner>
|
||||
<owner>better-together-dev@google.com</owner>
|
||||
<summary>
|
||||
Measures the completion of SecureChannel messages transfers via the Nearby
|
||||
Connections library. Emitted when the Nearby Connections library either
|
||||
sends or receives a message.
|
||||
</summary>
|
||||
</histogram>
|
||||
|
||||
<histogram name="MultiDevice.SecureChannel.Nearby.SendMessageResult"
|
||||
enum="BooleanSuccess" expires_after="2021-11-30">
|
||||
<owner>khorimoto@chromium.org</owner>
|
||||
|
Reference in New Issue
Block a user