Bug 1742408 - Add TRR skip reason telemetry that only includes relevant reasons r=nhnt11

Differential Revision: https://phabricator.services.mozilla.com/D131798
This commit is contained in:
Valentin Gosu 2021-11-23 08:34:46 +00:00
Родитель ff07766ece
Коммит aab7891ed0
3 изменённых файлов: 73 добавлений и 0 удалений

Просмотреть файл

@ -51,6 +51,27 @@ enum class TRRSkippedReason : uint32_t {
ODOH_DECRYPTION_FAILED = 36, // Failed to decrypt DNS packets.
};
inline bool IsRelevantTRRSkipReason(TRRSkippedReason aReason) {
// - TRR_REQ_MODE_DISABLED - these requests are intentionally skipping TRR.
// These include DNS queries used to bootstrap the TRR connection,
// captive portal checks, connectivity checks, etc.
// Since we don't want to use TRR for these connections, we don't need
// to include them with other relevant skip reasons.
// - TRR_DISABLED_FLAG - This reason is used when retrying failed connections,
// sync DNS resolves on the main thread, or requests coming from
// webextensions that choose to skip TRR
// - TRR_EXCLUDED - This reason is used when a certain domain is excluded
// from TRR because it is explicitly set by the user, or because it
// is part of the user's DNS suffix list, indicating a host that is likely
// to be on the local network.
if (aReason == TRRSkippedReason::TRR_REQ_MODE_DISABLED ||
aReason == TRRSkippedReason::TRR_DISABLED_FLAG ||
aReason == TRRSkippedReason::TRR_EXCLUDED) {
return false;
}
return true;
}
} // namespace net
} // namespace mozilla

Просмотреть файл

@ -312,6 +312,20 @@ void AddrHostRecord::ResolveComplete() {
: 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) {
Telemetry::Accumulate(
mNativeSuccess ? Telemetry::TRR_RELEVANT_SKIP_REASON_NATIVE_SUCCESS
: Telemetry::TRR_RELEVANT_SKIP_REASON_NATIVE_FAILED,
TRRService::ProviderKey(),
static_cast<uint32_t>(mTRRSkippedReason));
}
}
}
if (mEffectiveTRRMode == nsIRequest::TRR_FIRST_MODE) {

Просмотреть файл

@ -4641,6 +4641,44 @@
"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."
},
"TRR_RELEVANT_SKIP_REASON_TRR_FIRST": {
"record_in_processes": ["main", "socket"],
"products": ["firefox"],
"alert_emails": ["necko@mozilla.com", "vgosu@mozilla.com"],
"expires_in_version": "never",
"kind": "enumerated",
"keyed": true,
"n_values": 50,
"bug_numbers": [1649143, 1699523, 1742408],
"releaseChannelCollection": "opt-out",
"description": "When in TRR-first mode, it lists the reason we may have skipped TRR, keyed by the provider. Does not include requests that intentionally skip TRR."
},
"TRR_RELEVANT_SKIP_REASON_NATIVE_SUCCESS": {
"record_in_processes": ["main", "socket"],
"products": ["firefox"],
"alert_emails": ["necko@mozilla.com", "vgosu@mozilla.com"],
"expires_in_version": "never",
"kind": "enumerated",
"keyed": true,
"n_values": 50,
"bug_numbers": [1649143, 1699523, 1742408],
"releaseChannelCollection": "opt-out",
"description": "When in TRR-first mode, if TRR was skipped and native succeeded, it lists the reason we may have skipped TRR, keyed by the provider. Does not include requests that intentionally skip TRR."
},
"TRR_RELEVANT_SKIP_REASON_NATIVE_FAILED": {
"record_in_processes": ["main", "socket"],
"products": ["firefox"],
"alert_emails": ["necko@mozilla.com", "vgosu@mozilla.com"],
"expires_in_version": "never",
"kind": "enumerated",
"keyed": true,
"n_values": 50,
"bug_numbers": [1699523, 1742408],
"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."
},
"DNS_TRR_FIRST4": {
"record_in_processes": ["main", "socket"],
"products": ["firefox", "fennec"],