0

arc: add api to record arc dns resolution failure

Second highest reason for checkin failure is due to failed dns query.
We're adding a metric to track how common this issue is for hostname
used by checkin apis and every other hostname.

Android change: http://ag/15364401

BUG=b:183412745
TEST=blocked android.googleapis.com in dns sink and verified that the
metric is reported in chrome://histograms

Change-Id: Ib7aa74d83624a02f4e675e26c14431d83441337f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3046942
Commit-Queue: Muhammad Hasan Khan <mhasank@chromium.org>
Reviewed-by: Yuichiro Hanada <yhanada@chromium.org>
Reviewed-by: Robert Kaplow <rkaplow@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Reviewed-by: Hugo Benichi <hugobenichi@google.com>
Cr-Commit-Position: refs/heads/master@{#905370}
This commit is contained in:
Muhammad Hasan Khan
2021-07-26 19:37:22 +00:00
committed by Chromium LUCI CQ
parent 5040a90e9f
commit a8663eb646
4 changed files with 55 additions and 2 deletions
components/arc
tools/metrics/histograms/histograms_xml/arc

@ -119,6 +119,17 @@ const char* LowLatencyStylusLibraryTypeToString(
return "";
}
const char* DnsQueryToString(mojom::ArcDnsQuery query) {
switch (query) {
case mojom::ArcDnsQuery::OTHER_HOST_NAME:
return "Other";
case mojom::ArcDnsQuery::ANDROID_API_HOST_NAME:
return "AndroidApi";
}
NOTREACHED();
return "";
}
} // namespace
// static
@ -356,6 +367,15 @@ void ArcMetricsService::ReportAppKill(mojom::AppKillPtr app_kill) {
}
}
void ArcMetricsService::ReportDnsQueryResult(mojom::ArcDnsQuery query,
bool success) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
std::string metric_name =
base::StrCat({"Arc.Net.DnsQuery.", DnsQueryToString(query)});
VLOG(1) << metric_name << ": " << success;
base::UmaHistogramBoolean(metric_name, success);
}
void ArcMetricsService::NotifyLowMemoryKill() {
for (auto& obs : app_kill_observers_)
obs.OnArcLowMemoryKill();

@ -102,6 +102,7 @@ class ArcMetricsService : public KeyedService,
mojom::BootType boot_type) override;
void ReportNativeBridge(mojom::NativeBridgeType native_bridge_type) override;
void ReportCompanionLibApiUsage(mojom::CompanionLibApiId api_id) override;
void ReportDnsQueryResult(mojom::ArcDnsQuery query, bool success) override;
void ReportAppKill(mojom::AppKillPtr app_kill) override;
void ReportArcCorePriAbiMigEvent(
mojom::ArcCorePriAbiMigEvent event_type) override;

@ -1,7 +1,7 @@
// Copyright 2016 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.
// Next MinVersion: 13
// Next MinVersion: 14
module arc.mojom;
@ -149,6 +149,15 @@ enum CompanionLibApiId {
IS_CLIPPING_TO_TASK_DISABLED = 23,
};
[Extensible]
enum ArcDnsQuery {
// All other hostnames.
OTHER_HOST_NAME = 0,
// android.googleapis.com used by Android checkin.
ANDROID_API_HOST_NAME = 1,
};
// Describes the type of app kill being reported.
[Extensible]
enum AppKillType {
@ -232,7 +241,7 @@ enum LowLatencyStylusLibApiId {
kGLInkOverlaySetViewMatrix = 4,
};
// Next method ID: 16
// Next method ID: 17
interface MetricsHost {
// Reports boot progress events from ARC instance.
ReportBootProgress@0(array<BootProgressEvent> events,
@ -293,6 +302,11 @@ interface MetricsHost {
[MinVersion=12] ReportPerAppFixupMetrics@15(
mojo_base.mojom.TimeDelta duration,
uint32 number_of_directories);
// Reports the result of DNS query inside ARC.
[MinVersion=13] ReportDnsQueryResult@16(
ArcDnsQuery query,
bool success);
};
// Next method ID: 3

@ -959,6 +959,24 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>
<histogram name="Arc.Net.DnsQuery.AndroidApi" enum="BooleanSuccess"
expires_after="2022-07-22">
<owner>mhasank@google.com</owner>
<owner>arc-core@google.com</owner>
<summary>
Records the success result of DNS query resolution inside ARC.
</summary>
</histogram>
<histogram name="Arc.Net.DnsQuery.Other" enum="BooleanSuccess"
expires_after="2022-07-22">
<owner>mhasank@google.com</owner>
<owner>arc-core@google.com</owner>
<summary>
Records the success result of DNS query resolution inside ARC.
</summary>
</histogram>
<histogram name="Arc.OOMKills.Count" units="kills" expires_after="2021-03-07">
<obsolete>
Removed in Oct 2020. Now reported as Memory.OOMKills.Count.