Add UMA metrics to log attachment broker errors.
BUG=493414 Review URL: https://codereview.chromium.org/1281103002 Cr-Commit-Position: refs/heads/master@{#350312}
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "ipc/ipc_endpoint.h"
|
||||
|
||||
namespace IPC {
|
||||
@ -37,4 +38,9 @@ Sender* AttachmentBrokerPrivileged::GetSenderWithProcessId(base::ProcessId id) {
|
||||
return *it;
|
||||
}
|
||||
|
||||
void AttachmentBrokerPrivileged::LogError(UMAError error) {
|
||||
UMA_HISTOGRAM_ENUMERATION(
|
||||
"IPC.AttachmentBrokerPrivileged.BrokerAttachmentError", error, ERROR_MAX);
|
||||
}
|
||||
|
||||
} // namespace IPC
|
||||
|
@ -36,6 +36,24 @@ class IPC_EXPORT AttachmentBrokerPrivileged : public IPC::AttachmentBroker {
|
||||
// Returns nullptr if no sender is found.
|
||||
Sender* GetSenderWithProcessId(base::ProcessId id);
|
||||
|
||||
// Errors that can be reported by subclasses.
|
||||
// These match tools/metrics/histograms.xml.
|
||||
// This enum is append-only.
|
||||
enum UMAError {
|
||||
// The brokerable attachment had a valid destination. This is the success
|
||||
// case.
|
||||
DESTINATION_FOUND = 0,
|
||||
// The brokerable attachment had a destination, but the broker did not have
|
||||
// a channel of communication with that process.
|
||||
DESTINATION_NOT_FOUND = 1,
|
||||
// The brokerable attachment did not have a destination process.
|
||||
NO_DESTINATION = 2,
|
||||
ERROR_MAX
|
||||
};
|
||||
|
||||
// Emits an UMA metric.
|
||||
void LogError(UMAError error);
|
||||
|
||||
private:
|
||||
std::vector<Endpoint*> endpoints_;
|
||||
DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged);
|
||||
|
@ -59,8 +59,10 @@ void AttachmentBrokerPrivilegedWin::OnDuplicateWinHandle(
|
||||
IPC::internal::HandleAttachmentWin::WireFormat wire_format =
|
||||
base::get<0>(param);
|
||||
|
||||
if (wire_format.destination_process == base::kNullProcessId)
|
||||
if (wire_format.destination_process == base::kNullProcessId) {
|
||||
LogError(NO_DESTINATION);
|
||||
return;
|
||||
}
|
||||
|
||||
HandleWireFormat new_wire_format =
|
||||
DuplicateWinHandle(wire_format, message.get_sender_pid());
|
||||
@ -86,9 +88,11 @@ void AttachmentBrokerPrivilegedWin::RouteDuplicatedHandle(
|
||||
// forever.
|
||||
LOG(ERROR) << "Failed to deliver brokerable attachment to process with id: "
|
||||
<< dest;
|
||||
LogError(DESTINATION_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
|
||||
LogError(DESTINATION_FOUND);
|
||||
sender->Send(new AttachmentBrokerMsg_WinHandleHasBeenDuplicated(wire_format));
|
||||
}
|
||||
|
||||
|
@ -16179,6 +16179,15 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
|
||||
<summary>Network channel used for invalidations.</summary>
|
||||
</histogram>
|
||||
|
||||
<histogram name="IPC.AttachmentBrokerPrivileged.BrokerAttachmentError"
|
||||
enum="IPCAttachmentBrokerPrivilegedBrokerAttachmentError">
|
||||
<owner>erikchen@chromium.org</owner>
|
||||
<summary>
|
||||
Errors that the privileged attachment broker encounters while trying to
|
||||
broker attachments.
|
||||
</summary>
|
||||
</histogram>
|
||||
|
||||
<histogram name="Keyboard.KeystrokeDeltas" units="milliseconds">
|
||||
<owner>Please list the metric's owners. Add more owner tags as needed.</owner>
|
||||
<summary>
|
||||
@ -62028,6 +62037,19 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
|
||||
<int value="2" label="SubframeBlocked"/>
|
||||
</enum>
|
||||
|
||||
<enum name="IPCAttachmentBrokerPrivilegedBrokerAttachmentError" type="int">
|
||||
<int value="0" label="DESTINATION_FOUND">
|
||||
The brokerable attachment had a valid destination. This is the success case.
|
||||
</int>
|
||||
<int value="1" label="DESTINATION_NOT_FOUND">
|
||||
The brokerable attachment had a destination, but the broker did not have a
|
||||
channel of communication with that process.
|
||||
</int>
|
||||
<int value="2" label="NO_DESTINATION">
|
||||
The brokerable attachment did not have a destination process.
|
||||
</int>
|
||||
</enum>
|
||||
|
||||
<enum name="IPv6ConnectivityStatus" type="int">
|
||||
<int value="0" label="Incomplete IPv6 Configuration"/>
|
||||
<int value="1" label="Complete IPv6 Configuration"/>
|
||||
|
Reference in New Issue
Block a user