mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 1737198 - Part 4: Add telemetry probes. r=necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D132109
This commit is contained in:
parent
d3fe75231e
commit
61eae307cd
@ -7,6 +7,8 @@
|
||||
#include "TRRQuery.h"
|
||||
// Put DNSLogging.h at the end to avoid LOG being overwritten by other headers.
|
||||
#include "DNSLogging.h"
|
||||
#include "TRRSkippedReason.h"
|
||||
#include "mozilla/StaticPrefs_network.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "TRRService.h"
|
||||
|
||||
@ -261,6 +263,15 @@ bool AddrHostRecord::RemoveOrRefresh(bool aTrrToo) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void AddrHostRecord::NotifyRetryingTrr() {
|
||||
MOZ_ASSERT(mFirstTRRSkippedReason ==
|
||||
mozilla::net::TRRSkippedReason::TRR_UNSET);
|
||||
|
||||
// Save the skip reason of our first attempt for recording telemetry later.
|
||||
mFirstTRRSkippedReason = mTRRSkippedReason;
|
||||
mTRRSkippedReason = mozilla::net::TRRSkippedReason::TRR_UNSET;
|
||||
}
|
||||
|
||||
void AddrHostRecord::ResolveComplete() {
|
||||
if (LoadNativeUsed()) {
|
||||
if (mNativeSuccess) {
|
||||
@ -302,28 +313,60 @@ void AddrHostRecord::ResolveComplete() {
|
||||
|
||||
if (nsHostResolver::Mode() == nsIDNSService::MODE_TRRFIRST) {
|
||||
MOZ_ASSERT(mTRRSkippedReason != mozilla::net::TRRSkippedReason::TRR_UNSET);
|
||||
Telemetry::Accumulate(Telemetry::TRR_SKIP_REASON_TRR_FIRST2,
|
||||
TRRService::ProviderKey(),
|
||||
static_cast<uint32_t>(mTRRSkippedReason));
|
||||
|
||||
if (!mTRRSuccess) {
|
||||
Telemetry::Accumulate(
|
||||
mNativeSuccess ? Telemetry::TRR_SKIP_REASON_NATIVE_SUCCESS
|
||||
: Telemetry::TRR_SKIP_REASON_NATIVE_FAILED,
|
||||
TRRService::ProviderKey(), static_cast<uint32_t>(mTRRSkippedReason));
|
||||
}
|
||||
if (StaticPrefs::network_trr_strict_native_fallback()) {
|
||||
nsAutoCString telemetryKey(TRRService::ProviderKey());
|
||||
|
||||
if (IsRelevantTRRSkipReason(mTRRSkippedReason)) {
|
||||
Telemetry::Accumulate(Telemetry::TRR_RELEVANT_SKIP_REASON_TRR_FIRST,
|
||||
TRRService::ProviderKey(),
|
||||
if (mFirstTRRSkippedReason != mozilla::net::TRRSkippedReason::TRR_UNSET) {
|
||||
telemetryKey.AppendLiteral("|");
|
||||
telemetryKey.AppendInt(static_cast<uint32_t>(mFirstTRRSkippedReason));
|
||||
|
||||
Telemetry::Accumulate(mTRRSuccess
|
||||
? Telemetry::TRR_SKIP_REASON_RETRY_SUCCESS
|
||||
: Telemetry::TRR_SKIP_REASON_RETRY_FAILED,
|
||||
TRRService::ProviderKey(),
|
||||
static_cast<uint32_t>(mFirstTRRSkippedReason));
|
||||
}
|
||||
|
||||
Telemetry::Accumulate(Telemetry::TRR_SKIP_REASON_STRICT_MODE,
|
||||
telemetryKey,
|
||||
static_cast<uint32_t>(mTRRSkippedReason));
|
||||
|
||||
if (mTRRSuccess) {
|
||||
Telemetry::Accumulate(Telemetry::TRR_ATTEMPT_COUNT,
|
||||
TRRService::ProviderKey(), mTrrAttempts);
|
||||
} else if (LoadNativeUsed()) {
|
||||
Telemetry::Accumulate(mNativeSuccess
|
||||
? Telemetry::TRR_SKIP_REASON_NATIVE_SUCCESS
|
||||
: Telemetry::TRR_SKIP_REASON_NATIVE_FAILED,
|
||||
TRRService::ProviderKey(),
|
||||
static_cast<uint32_t>(mTRRSkippedReason));
|
||||
}
|
||||
} else {
|
||||
Telemetry::Accumulate(Telemetry::TRR_SKIP_REASON_TRR_FIRST2,
|
||||
TRRService::ProviderKey(),
|
||||
static_cast<uint32_t>(mTRRSkippedReason));
|
||||
if (!mTRRSuccess) {
|
||||
Telemetry::Accumulate(
|
||||
mNativeSuccess ? Telemetry::TRR_RELEVANT_SKIP_REASON_NATIVE_SUCCESS
|
||||
: Telemetry::TRR_RELEVANT_SKIP_REASON_NATIVE_FAILED,
|
||||
TRRService::ProviderKey(),
|
||||
static_cast<uint32_t>(mTRRSkippedReason));
|
||||
Telemetry::Accumulate(mNativeSuccess
|
||||
? Telemetry::TRR_SKIP_REASON_NATIVE_SUCCESS
|
||||
: Telemetry::TRR_SKIP_REASON_NATIVE_FAILED,
|
||||
TRRService::ProviderKey(),
|
||||
static_cast<uint32_t>(mTRRSkippedReason));
|
||||
}
|
||||
|
||||
if (IsRelevantTRRSkipReason(mTRRSkippedReason)) {
|
||||
Telemetry::Accumulate(Telemetry::TRR_RELEVANT_SKIP_REASON_TRR_FIRST,
|
||||
TRRService::ProviderKey(),
|
||||
static_cast<uint32_t>(mTRRSkippedReason));
|
||||
|
||||
if (!mTRRSuccess && LoadNativeUsed()) {
|
||||
Telemetry::Accumulate(
|
||||
mNativeSuccess
|
||||
? Telemetry::TRR_RELEVANT_SKIP_REASON_NATIVE_SUCCESS
|
||||
: Telemetry::TRR_RELEVANT_SKIP_REASON_NATIVE_FAILED,
|
||||
TRRService::ProviderKey(),
|
||||
static_cast<uint32_t>(mTRRSkippedReason));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,6 +186,7 @@ class nsHostRecord : public mozilla::LinkedListElement<RefPtr<nsHostRecord>>,
|
||||
nsIRequest::TRRMode mEffectiveTRRMode = nsIRequest::TRR_DEFAULT_MODE;
|
||||
|
||||
TRRSkippedReason mTRRSkippedReason = TRRSkippedReason::TRR_UNSET;
|
||||
TRRSkippedReason mFirstTRRSkippedReason = TRRSkippedReason::TRR_UNSET;
|
||||
TRRSkippedReason mTRRAFailReason = TRRSkippedReason::TRR_UNSET;
|
||||
TRRSkippedReason mTRRAAAAFailReason = TRRSkippedReason::TRR_UNSET;
|
||||
|
||||
@ -271,6 +272,9 @@ class AddrHostRecord final : public nsHostRecord {
|
||||
bool RemoveOrRefresh(bool aTrrToo); // Mark records currently being resolved
|
||||
// as needed to resolve again.
|
||||
|
||||
// Saves the skip reason of a first-attempt TRR lookup and clears
|
||||
// it to prepare for a retry attempt.
|
||||
void NotifyRetryingTrr();
|
||||
void ResolveComplete();
|
||||
|
||||
static DnsPriority GetPriority(uint16_t aFlags);
|
||||
|
@ -1080,9 +1080,9 @@ nsresult nsHostResolver::NameLookup(nsHostRecord* rec,
|
||||
}
|
||||
|
||||
// Make sure we reset the reason each time we attempt to do a new lookup
|
||||
// so we don't wronly report the reason for the previous one.
|
||||
// so we don't wrongly report the reason for the previous one.
|
||||
rec->mTRRSkippedReason = TRRSkippedReason::TRR_UNSET;
|
||||
|
||||
rec->mFirstTRRSkippedReason = TRRSkippedReason::TRR_UNSET;
|
||||
rec->mTrrAttempts = 0;
|
||||
|
||||
ComputeEffectiveTRRMode(rec);
|
||||
@ -1352,6 +1352,7 @@ bool nsHostResolver::MaybeRetryTRRLookup(
|
||||
auto trrQuery = aAddrRec->mTRRQuery.Lock();
|
||||
trrQuery.ref() = nullptr;
|
||||
}
|
||||
aAddrRec->NotifyRetryingTrr();
|
||||
TrrLookup(aAddrRec, aLock, nullptr /* pushedTRR */);
|
||||
return true;
|
||||
}
|
||||
|
@ -497,6 +497,8 @@ nsresult TRRServiceChannel::ContinueOnBeforeConnect() {
|
||||
mConnectionInfo->SetIPv6Disabled(mCaps & NS_HTTP_DISABLE_IPV6);
|
||||
|
||||
if (mLoadFlags & LOAD_FRESH_CONNECTION) {
|
||||
Telemetry::ScalarAdd(
|
||||
Telemetry::ScalarID::NETWORKING_TRR_CONNECTION_CYCLE_COUNT, 1);
|
||||
nsresult rv =
|
||||
gHttpHandler->ConnMgr()->DoSingleConnectionCleanup(mConnectionInfo);
|
||||
LOG(
|
||||
|
@ -4678,7 +4678,54 @@
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "When in TRR-first mode, if TRR was skipped and native failed, it lists the reason we may have skipped TRR, keyed by the provider. Does not include requests that intentionally skip TRR."
|
||||
},
|
||||
|
||||
"TRR_SKIP_REASON_STRICT_MODE": {
|
||||
"record_in_processes": ["main", "socket"],
|
||||
"products": ["firefox"],
|
||||
"alert_emails": ["necko@mozilla.com", "nhnt11@mozilla.com"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"keyed": true,
|
||||
"n_values": 50,
|
||||
"bug_numbers": [1737198],
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "When in TRR-first mode, it lists the reason we may have skipped TRR. The key is like `<provider>|<skip reason of first attempt>` or just `<provider>` used when there was no second attempt."
|
||||
},
|
||||
"TRR_SKIP_REASON_RETRY_SUCCESS": {
|
||||
"record_in_processes": ["main", "socket"],
|
||||
"products": ["firefox"],
|
||||
"alert_emails": ["necko@mozilla.com", "nhnt11@mozilla.com"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"keyed": true,
|
||||
"n_values": 50,
|
||||
"bug_numbers": [1737198],
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "When in TRR-first mode, if TRR failed once and was successfully retried, it lists the reason for the first failure, keyed by the provider."
|
||||
},
|
||||
"TRR_SKIP_REASON_RETRY_FAILED": {
|
||||
"record_in_processes": ["main", "socket"],
|
||||
"products": ["firefox"],
|
||||
"alert_emails": ["necko@mozilla.com", "nhnt11@mozilla.com"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"keyed": true,
|
||||
"n_values": 50,
|
||||
"bug_numbers": [1737198],
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "When in TRR-first mode, if TRR failed once and retried unsuccessfully, it lists the reason for the first failure, keyed by the provider."
|
||||
},
|
||||
"TRR_ATTEMPT_COUNT": {
|
||||
"record_in_processes": ["main", "socket"],
|
||||
"products": ["firefox"],
|
||||
"alert_emails": ["necko@mozilla.com", "nhnt11@mozilla.com"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "enumerated",
|
||||
"keyed": true,
|
||||
"n_values": 10,
|
||||
"bug_numbers": [1737198],
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"description": "Number of times we attempted TRR for a successful lookup in TRR-first mode. Keyed by provider."
|
||||
},
|
||||
"DNS_TRR_FIRST4": {
|
||||
"record_in_processes": ["main", "socket"],
|
||||
"products": ["firefox", "fennec"],
|
||||
|
@ -6094,6 +6094,25 @@ networking:
|
||||
record_in_processes:
|
||||
- 'main'
|
||||
|
||||
trr_connection_cycle_count:
|
||||
bug_numbers:
|
||||
- 1737198
|
||||
description: >
|
||||
Number of times we cycled the TRR connection during a subsession.
|
||||
Keyed by TRR provider URL.
|
||||
expires: never
|
||||
keyed: true
|
||||
kind: uint
|
||||
release_channel_collection: opt-out
|
||||
notification_emails:
|
||||
- necko@mozilla.com
|
||||
- nhnt11@mozilla.com
|
||||
products:
|
||||
- 'firefox'
|
||||
record_in_processes:
|
||||
- 'main'
|
||||
- 'socket'
|
||||
|
||||
blocklist:
|
||||
lastModified_rs_addons:
|
||||
bug_numbers:
|
||||
|
@ -325,6 +325,7 @@ const DEFAULT_ENVIRONMENT_PREFS = new Map([
|
||||
["network.proxy.http", { what: RECORD_PREF_STATE }],
|
||||
["network.proxy.ssl", { what: RECORD_PREF_STATE }],
|
||||
["network.trr.mode", { what: RECORD_PREF_VALUE }],
|
||||
["network.trr.strict_native_fallback", { what: RECORD_PREF_VALUE }],
|
||||
["pdfjs.disabled", { what: RECORD_PREF_VALUE }],
|
||||
["places.history.enabled", { what: RECORD_PREF_VALUE }],
|
||||
["plugins.show_infobar", { what: RECORD_PREF_VALUE }],
|
||||
|
Loading…
Reference in New Issue
Block a user