From 3d66c37e7682107bfe34de575088d618f7c76fe1 Mon Sep 17 00:00:00 2001 From: Kershaw Chang Date: Thu, 18 Feb 2021 12:50:04 +0000 Subject: [PATCH] Bug 1689987 - P5: Add probes to collect DNS lookup time when ODoH is used r=necko-reviewers,valentin Differential Revision: https://phabricator.services.mozilla.com/D105215 --- netwerk/base/nsLoadGroup.cpp | 17 +++++++++++++++ toolkit/components/telemetry/Histograms.json | 22 ++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/netwerk/base/nsLoadGroup.cpp b/netwerk/base/nsLoadGroup.cpp index ea8acb73cb1a..1442eb9fd04e 100644 --- a/netwerk/base/nsLoadGroup.cpp +++ b/netwerk/base/nsLoadGroup.cpp @@ -968,6 +968,23 @@ void nsLoadGroup::TelemetryReportChannel(nsITimedChannel* aTimedChannel, } } + if (StaticPrefs::network_trr_odoh_enabled() && !domainLookupStart.IsNull() && + !domainLookupEnd.IsNull()) { + nsCOMPtr dns = do_GetService(NS_DNSSERVICE_CONTRACTID); + bool ODoHActivated = false; + if (dns && NS_SUCCEEDED(dns->GetODoHActivated(&ODoHActivated)) && + ODoHActivated) { + if (aDefaultRequest) { + Telemetry::AccumulateTimeDelta( + Telemetry::HTTP_PAGE_DNS_ODOH_LOOKUP_TIME, domainLookupStart, + domainLookupEnd); + } else { + Telemetry::AccumulateTimeDelta(Telemetry::HTTP_SUB_DNS_ODOH_LOOKUP_TIME, + domainLookupStart, domainLookupEnd); + } + } + } + #undef HTTP_REQUEST_HISTOGRAMS } diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 2530d10d1c0a..fad57c56dc58 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -16468,5 +16468,27 @@ "bug_numbers": [1689987], "releaseChannelCollection": "opt-out", "description": "When in ODoH-first mode, it lists the reason we may have skipped ODoH" + }, + "HTTP_PAGE_DNS_ODOH_LOOKUP_TIME": { + "record_in_processes": ["main", "content"], + "products": ["firefox"], + "expires_in_version": "never", + "alert_emails": ["necko@mozilla.com", "kershaw@mozilla.com"], + "kind": "exponential", + "high": 30000, + "n_buckets": 50, + "description": "HTTP page channel: ODoH lookup time (ms)", + "bug_numbers": [1689987] + }, + "HTTP_SUB_DNS_ODOH_LOOKUP_TIME": { + "record_in_processes": ["main", "content"], + "products": ["firefox"], + "expires_in_version": "never", + "kind": "exponential", + "high": 30000, + "n_buckets": 50, + "bug_numbers": [1689987], + "alert_emails": ["necko@mozilla.com", "kershaw@mozilla.com"], + "description": "HTTP subitem channel: ODoH lookup time (ms)" } }