forked from mirrors/gecko-dev
Bug 1885529 - Measure time spent in native HTTPS call r=necko-reviewers,jesup
Differential Revision: https://phabricator.services.mozilla.com/D206335
This commit is contained in:
parent
3e46100c7c
commit
bf6deef147
4 changed files with 31 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "GetAddrInfo.h"
|
||||
#include "mozilla/glean/GleanMetrics.h"
|
||||
#include "mozilla/net/DNSPacket.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
|
@ -71,6 +72,7 @@ nsresult ResolveHTTPSRecordImpl(const nsACString& aHost, uint16_t aFlags,
|
|||
}
|
||||
|
||||
LOG("resolving %s\n", host.get());
|
||||
TimeStamp startTime = TimeStamp::Now();
|
||||
// Perform the query
|
||||
rv = packet.FillBuffer(
|
||||
[&](unsigned char response[DNSPacket::MAX_SIZE]) -> int {
|
||||
|
|
@ -118,6 +120,8 @@ nsresult ResolveHTTPSRecordImpl(const nsACString& aHost, uint16_t aFlags,
|
|||
|
||||
return len - 8;
|
||||
});
|
||||
mozilla::glean::networking::dns_native_https_call_time.AccumulateRawDuration(
|
||||
TimeStamp::Now() - startTime);
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG("failed rv");
|
||||
return rv;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "GetAddrInfo.h"
|
||||
#include "mozilla/glean/GleanMetrics.h"
|
||||
#include "mozilla/net/DNSPacket.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
|
@ -55,6 +56,7 @@ nsresult ResolveHTTPSRecordImpl(const nsACString& aHost, uint16_t aFlags,
|
|||
rv = packet.FillBuffer(
|
||||
[&](unsigned char response[DNSPacket::MAX_SIZE]) -> int {
|
||||
int len = 0;
|
||||
TimeStamp startTime = TimeStamp::Now();
|
||||
#if defined(HAVE_RES_NINIT)
|
||||
len = res_nquery(sThreadRes.get(), host.get(), ns_c_in,
|
||||
nsIDNSService::RESOLVE_TYPE_HTTPSSVC, response,
|
||||
|
|
@ -65,6 +67,8 @@ nsresult ResolveHTTPSRecordImpl(const nsACString& aHost, uint16_t aFlags,
|
|||
response, DNSPacket::MAX_SIZE);
|
||||
#endif
|
||||
|
||||
mozilla::glean::networking::dns_native_https_call_time
|
||||
.AccumulateRawDuration(TimeStamp::Now() - startTime);
|
||||
if (len < 0) {
|
||||
LOG("DNS query failed");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "GetAddrInfo.h"
|
||||
#include "mozilla/glean/GleanMetrics.h"
|
||||
#include "mozilla/net/DNSPacket.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
|
|
@ -39,9 +40,15 @@ nsresult ResolveHTTPSRecordImpl(const nsACString& aHost, uint16_t aFlags,
|
|||
return NS_ERROR_UNKNOWN_HOST;
|
||||
}
|
||||
|
||||
TimeStamp startTime = TimeStamp::Now();
|
||||
|
||||
DNS_STATUS status =
|
||||
DnsQuery_A(host.get(), nsIDNSService::RESOLVE_TYPE_HTTPSSVC,
|
||||
DNS_QUERY_STANDARD, nullptr, &result, nullptr);
|
||||
|
||||
mozilla::glean::networking::dns_native_https_call_time.AccumulateRawDuration(
|
||||
TimeStamp::Now() - startTime);
|
||||
|
||||
if (status != ERROR_SUCCESS) {
|
||||
LOG("DnsQuery_A failed with error: %ld\n", status);
|
||||
return NS_ERROR_UNKNOWN_HOST;
|
||||
|
|
|
|||
|
|
@ -368,6 +368,22 @@ networking:
|
|||
expires: never
|
||||
telemetry_mirror: DNS_FAILED_LOOKUP_TIME
|
||||
|
||||
dns_native_https_call_time:
|
||||
type: timing_distribution
|
||||
time_unit: millisecond
|
||||
description: >
|
||||
Time spent in the call to the native OS DNS resolution.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1885529
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1885529
|
||||
data_sensitivity:
|
||||
- technical
|
||||
notification_emails:
|
||||
- necko@mozilla.com
|
||||
- vgosu@mozilla.com
|
||||
expires: never
|
||||
|
||||
dns_native_count:
|
||||
type: labeled_counter
|
||||
description: >
|
||||
|
|
|
|||
Loading…
Reference in a new issue