Bug 1640867 - Record TRR steering telemetry separately r=dragana,tdsmith,necko-reviewers

This change makes a set of probes keyed. The key is "(default)" if no steering
is currently active, or "(auto-detected)" is the current URL has been set
by steering (autodetection).

Differential Revision: https://phabricator.services.mozilla.com/D77022
This commit is contained in:
Valentin Gosu 2020-05-29 21:23:41 +00:00
Родитель 66a434b9be
Коммит 5570291ec4
5 изменённых файлов: 89 добавлений и 48 удалений

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

@ -254,14 +254,16 @@ nsresult TRR::SendHTTPRequest() {
gTRRService->IsTRRBlacklisted(mHost, mOriginSuffix, mPB, true)) { gTRRService->IsTRRBlacklisted(mHost, mOriginSuffix, mPB, true)) {
if (mType == TRRTYPE_A) { if (mType == TRRTYPE_A) {
// count only blacklist for A records to avoid double counts // count only blacklist for A records to avoid double counts
Telemetry::Accumulate(Telemetry::DNS_TRR_BLACKLISTED, true); Telemetry::Accumulate(Telemetry::DNS_TRR_BLACKLISTED2,
TRRService::AutoDetectedKey(), true);
} }
// not really an error but no TRR is issued // not really an error but no TRR is issued
return NS_ERROR_UNKNOWN_HOST; return NS_ERROR_UNKNOWN_HOST;
} }
if (UseDefaultServer() && (mType == TRRTYPE_A)) { if (UseDefaultServer() && (mType == TRRTYPE_A)) {
Telemetry::Accumulate(Telemetry::DNS_TRR_BLACKLISTED, false); Telemetry::Accumulate(Telemetry::DNS_TRR_BLACKLISTED2,
TRRService::AutoDetectedKey(), false);
} }
} }

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

@ -102,6 +102,17 @@ bool TRRService::CheckCaptivePortalIsPassed() {
return result; return result;
} }
NS_NAMED_LITERAL_CSTRING(kTRRIsAutoDetectedKey, "(auto-detected)");
NS_NAMED_LITERAL_CSTRING(kTRRNotAutoDetectedKey, "(default)");
// static
const nsCString& TRRService::AutoDetectedKey() {
if (gTRRService && gTRRService->IsUsingAutoDetectedURL()) {
return kTRRIsAutoDetectedKey.AsString();
}
return kTRRNotAutoDetectedKey.AsString();
}
nsresult TRRService::Init() { nsresult TRRService::Init() {
MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
if (mInitialized) { if (mInitialized) {
@ -895,11 +906,13 @@ void TRRService::TRRIsOkay(enum TrrOkay aReason) {
XRE_IsSocketProcess(), XRE_IsSocketProcess(),
NS_IsMainThread()); NS_IsMainThread());
Telemetry::AccumulateCategorical( Telemetry::AccumulateCategoricalKeyed(
aReason == OKAY_NORMAL ? Telemetry::LABELS_DNS_TRR_SUCCESS::Fine AutoDetectedKey(),
: (aReason == OKAY_TIMEOUT aReason == OKAY_NORMAL
? Telemetry::LABELS_DNS_TRR_SUCCESS::Timeout ? Telemetry::LABELS_DNS_TRR_SUCCESS2::Fine
: Telemetry::LABELS_DNS_TRR_SUCCESS::Bad)); : (aReason == OKAY_TIMEOUT
? Telemetry::LABELS_DNS_TRR_SUCCESS2::Timeout
: Telemetry::LABELS_DNS_TRR_SUCCESS2::Bad));
if (aReason == OKAY_NORMAL) { if (aReason == OKAY_NORMAL) {
mTRRFailures = 0; mTRRFailures = 0;
} else if ((mMode == MODE_TRRFIRST) && (mConfirmationState == CONFIRM_OK)) { } else if ((mMode == MODE_TRRFIRST) && (mConfirmationState == CONFIRM_OK)) {
@ -960,7 +973,8 @@ AHostResolver::LookupStatus TRRService::CompleteLookup(
// don't accumulate trronly data here since trronly failures are // don't accumulate trronly data here since trronly failures are
// handled above by trying again, so counting the successes here would // handled above by trying again, so counting the successes here would
// skew the numbers // skew the numbers
Telemetry::Accumulate(Telemetry::DNS_TRR_NS_VERFIFIED, Telemetry::Accumulate(Telemetry::DNS_TRR_NS_VERFIFIED2,
TRRService::AutoDetectedKey(),
(mConfirmationState == CONFIRM_OK)); (mConfirmationState == CONFIRM_OK));
} }
mRetryConfirmInterval = 1000; mRetryConfirmInterval = 1000;

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

@ -74,6 +74,9 @@ class TRRService : public TRRServiceBase,
already_AddRefed<nsIThread> TRRThread(); already_AddRefed<nsIThread> TRRThread();
bool IsOnTRRThread(); bool IsOnTRRThread();
bool IsUsingAutoDetectedURL() { return mURISetByDetection; }
static const nsCString& AutoDetectedKey();
private: private:
virtual ~TRRService(); virtual ~TRRService();

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

@ -414,51 +414,66 @@ void AddrHostRecord::ResolveComplete() {
uint32_t millis = static_cast<uint32_t>(mNativeDuration.ToMilliseconds()); uint32_t millis = static_cast<uint32_t>(mNativeDuration.ToMilliseconds());
Telemetry::Accumulate(Telemetry::DNS_NATIVE_LOOKUP_TIME, millis); Telemetry::Accumulate(Telemetry::DNS_NATIVE_LOOKUP_TIME, millis);
} }
AccumulateCategorical( AccumulateCategoricalKeyed(
mNativeSuccess ? Telemetry::LABELS_DNS_LOOKUP_DISPOSITION::osOK TRRService::AutoDetectedKey(),
: Telemetry::LABELS_DNS_LOOKUP_DISPOSITION::osFail); mNativeSuccess ? Telemetry::LABELS_DNS_LOOKUP_DISPOSITION2::osOK
: Telemetry::LABELS_DNS_LOOKUP_DISPOSITION2::osFail);
} }
if (mTRRUsed) { if (mTRRUsed) {
if (mTRRSuccess) { if (mTRRSuccess) {
uint32_t millis = static_cast<uint32_t>(mTrrDuration.ToMilliseconds()); uint32_t millis = static_cast<uint32_t>(mTrrDuration.ToMilliseconds());
Telemetry::Accumulate(Telemetry::DNS_TRR_LOOKUP_TIME, millis); Telemetry::Accumulate(Telemetry::DNS_TRR_LOOKUP_TIME2,
TRRService::AutoDetectedKey(), millis);
} }
AccumulateCategorical( AccumulateCategoricalKeyed(
mTRRSuccess ? Telemetry::LABELS_DNS_LOOKUP_DISPOSITION::trrOK TRRService::AutoDetectedKey(),
: Telemetry::LABELS_DNS_LOOKUP_DISPOSITION::trrFail); mTRRSuccess ? Telemetry::LABELS_DNS_LOOKUP_DISPOSITION2::trrOK
: Telemetry::LABELS_DNS_LOOKUP_DISPOSITION2::trrFail);
if (mTrrAUsed == OK) { if (mTrrAUsed == OK) {
AccumulateCategorical(Telemetry::LABELS_DNS_LOOKUP_DISPOSITION::trrAOK); AccumulateCategoricalKeyed(
TRRService::AutoDetectedKey(),
Telemetry::LABELS_DNS_LOOKUP_DISPOSITION2::trrAOK);
} else if (mTrrAUsed == FAILED) { } else if (mTrrAUsed == FAILED) {
AccumulateCategorical(Telemetry::LABELS_DNS_LOOKUP_DISPOSITION::trrAFail); AccumulateCategoricalKeyed(
TRRService::AutoDetectedKey(),
Telemetry::LABELS_DNS_LOOKUP_DISPOSITION2::trrAFail);
} }
if (mTrrAAAAUsed == OK) { if (mTrrAAAAUsed == OK) {
AccumulateCategorical( AccumulateCategoricalKeyed(
Telemetry::LABELS_DNS_LOOKUP_DISPOSITION::trrAAAAOK); TRRService::AutoDetectedKey(),
Telemetry::LABELS_DNS_LOOKUP_DISPOSITION2::trrAAAAOK);
} else if (mTrrAAAAUsed == FAILED) { } else if (mTrrAAAAUsed == FAILED) {
AccumulateCategorical( AccumulateCategoricalKeyed(
Telemetry::LABELS_DNS_LOOKUP_DISPOSITION::trrAAAAFail); TRRService::AutoDetectedKey(),
Telemetry::LABELS_DNS_LOOKUP_DISPOSITION2::trrAAAAFail);
} }
} }
if (mEffectiveTRRMode == nsIRequest::TRR_FIRST_MODE) { if (mEffectiveTRRMode == nsIRequest::TRR_FIRST_MODE) {
if (flags & nsIDNSService::RESOLVE_DISABLE_TRR) { if (flags & nsIDNSService::RESOLVE_DISABLE_TRR) {
// TRR is disabled on request, which is a next-level back-off method. // TRR is disabled on request, which is a next-level back-off method.
Telemetry::Accumulate(Telemetry::DNS_TRR_DISABLED, mNativeSuccess); Telemetry::Accumulate(Telemetry::DNS_TRR_DISABLED2,
TRRService::AutoDetectedKey(), mNativeSuccess);
} else { } else {
if (mTRRSuccess) { if (mTRRSuccess) {
AccumulateCategorical(Telemetry::LABELS_DNS_TRR_FIRST2::TRR); AccumulateCategoricalKeyed(TRRService::AutoDetectedKey(),
Telemetry::LABELS_DNS_TRR_FIRST3::TRR);
} else if (mNativeSuccess) { } else if (mNativeSuccess) {
if (mTRRUsed) { if (mTRRUsed) {
AccumulateCategorical( AccumulateCategoricalKeyed(
Telemetry::LABELS_DNS_TRR_FIRST2::NativeAfterTRR); TRRService::AutoDetectedKey(),
Telemetry::LABELS_DNS_TRR_FIRST3::NativeAfterTRR);
} else { } else {
AccumulateCategorical(Telemetry::LABELS_DNS_TRR_FIRST2::Native); AccumulateCategoricalKeyed(TRRService::AutoDetectedKey(),
Telemetry::LABELS_DNS_TRR_FIRST3::Native);
} }
} else { } else {
AccumulateCategorical(Telemetry::LABELS_DNS_TRR_FIRST2::BothFailed); AccumulateCategoricalKeyed(
TRRService::AutoDetectedKey(),
Telemetry::LABELS_DNS_TRR_FIRST3::BothFailed);
} }
} }
} }

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

@ -3943,17 +3943,18 @@
"n_buckets": 50, "n_buckets": 50,
"description": "Time for a successful DNS resolution (msec)" "description": "Time for a successful DNS resolution (msec)"
}, },
"DNS_TRR_LOOKUP_TIME": { "DNS_TRR_LOOKUP_TIME2": {
"record_in_processes": ["main"], "record_in_processes": ["main"],
"products": ["firefox", "fennec", "geckoview"], "products": ["firefox", "fennec", "geckoview"],
"expires_in_version": "never", "expires_in_version": "never",
"kind": "exponential", "kind": "exponential",
"high": 60000, "high": 60000,
"keyed": true,
"releaseChannelCollection": "opt-out", "releaseChannelCollection": "opt-out",
"alert_emails": ["necko@mozilla.com"], "alert_emails": ["necko@mozilla.com"],
"bug_numbers": [1434852], "bug_numbers": [1434852, 1640867],
"n_buckets": 50, "n_buckets": 50,
"description": "Time for a completed TRR resolution (msec)" "description": "Time for a completed TRR resolution (msec); Keyed by TRR auto-detected"
}, },
"DNS_TRR_PROCESSING_TIME": { "DNS_TRR_PROCESSING_TIME": {
"record_in_processes": ["main"], "record_in_processes": ["main"],
@ -4037,43 +4038,47 @@
"releaseChannelCollection": "opt-out", "releaseChannelCollection": "opt-out",
"description": "DNS: success distribution when both native and TRR were used" "description": "DNS: success distribution when both native and TRR were used"
}, },
"DNS_TRR_FIRST2": { "DNS_TRR_FIRST3": {
"record_in_processes": ["main"], "record_in_processes": ["main"],
"products": ["firefox", "fennec", "geckoview"], "products": ["firefox", "fennec", "geckoview"],
"alert_emails": ["necko@mozilla.com"], "alert_emails": ["necko@mozilla.com"],
"expires_in_version": "never", "expires_in_version": "never",
"kind": "categorical", "kind": "categorical",
"keyed": true,
"labels": ["TRR", "NativeAfterTRR", "Native", "BothFailed"], "labels": ["TRR", "NativeAfterTRR", "Native", "BothFailed"],
"bug_numbers": [1497252], "bug_numbers": [1497252, 1640867],
"releaseChannelCollection": "opt-out", "releaseChannelCollection": "opt-out",
"description": "TRR-first mode distribution. 0=Worked, 1=fell back fine after TRR fail, 2=native worked, 3=both failed" "description": "TRR-first mode distribution. 0=Worked, 1=fell back fine after TRR fail, 2=native worked, 3=both failed; Keyed by TRR auto-detected"
}, },
"DNS_TRR_DISABLED": { "DNS_TRR_DISABLED2": {
"record_in_processes": ["main"], "record_in_processes": ["main"],
"products": ["firefox", "fennec", "geckoview"], "products": ["firefox", "fennec", "geckoview"],
"expires_in_version": "never", "expires_in_version": "never",
"kind": "boolean", "kind": "boolean",
"description": "Resolve success rate when in TRR-first and called TRR-disabled (fall-back mode)", "keyed": true,
"bug_numbers": [1472659], "description": "Resolve success rate when in TRR-first and called TRR-disabled (fall-back mode); Keyed by TRR auto-detected",
"bug_numbers": [1472659, 1640867],
"releaseChannelCollection": "opt-out", "releaseChannelCollection": "opt-out",
"alert_emails": ["necko@mozilla.com"] "alert_emails": ["necko@mozilla.com"]
}, },
"DNS_TRR_BLACKLISTED": { "DNS_TRR_BLACKLISTED2": {
"record_in_processes": ["main"], "record_in_processes": ["main"],
"products": ["firefox", "fennec", "geckoview"], "products": ["firefox", "fennec", "geckoview"],
"expires_in_version": "never", "expires_in_version": "never",
"kind": "boolean", "kind": "boolean",
"description": "DNS check for TRR was blocked by blacklist", "keyed": true,
"bug_numbers": [1434852], "description": "DNS check for TRR was blocked by blacklist; Keyed by TRR auto-detected",
"bug_numbers": [1434852, 1640867],
"alert_emails": ["necko@mozilla.com"] "alert_emails": ["necko@mozilla.com"]
}, },
"DNS_TRR_NS_VERFIFIED": { "DNS_TRR_NS_VERFIFIED2": {
"record_in_processes": ["main"], "record_in_processes": ["main"],
"products": ["firefox", "fennec", "geckoview"], "products": ["firefox", "fennec", "geckoview"],
"expires_in_version": "never", "expires_in_version": "never",
"kind": "boolean", "kind": "boolean",
"description": "TRR managed to verify NS entry", "keyed": true,
"bug_numbers": [1453825], "description": "TRR managed to verify NS entry; Keyed by TRR auto-detected",
"bug_numbers": [1453825, 1640867],
"alert_emails": ["necko@mozilla.com"] "alert_emails": ["necko@mozilla.com"]
}, },
"DNS_TRR_REQUEST_PER_CONN": { "DNS_TRR_REQUEST_PER_CONN": {
@ -4087,14 +4092,15 @@
"bug_numbers": [1470853], "bug_numbers": [1470853],
"description": "Number of DOH requests per connection" "description": "Number of DOH requests per connection"
}, },
"DNS_TRR_SUCCESS": { "DNS_TRR_SUCCESS2": {
"record_in_processes": ["main"], "record_in_processes": ["main"],
"products": ["firefox", "fennec", "geckoview"], "products": ["firefox", "fennec", "geckoview"],
"expires_in_version": "never", "expires_in_version": "never",
"kind": "categorical", "kind": "categorical",
"keyed": true,
"labels": ["Fine", "Timeout", "Bad"], "labels": ["Fine", "Timeout", "Bad"],
"description": "How often TRR (Trusted Recursive Resolver) requests are fine, time-out or error.", "description": "How often TRR (Trusted Recursive Resolver) requests are fine, time-out or error. Keyed by TRR auto-detected",
"bug_numbers": [1497438], "bug_numbers": [1497438, 1640867],
"releaseChannelCollection": "opt-out", "releaseChannelCollection": "opt-out",
"alert_emails": ["necko@mozilla.com"] "alert_emails": ["necko@mozilla.com"]
}, },
@ -4118,17 +4124,18 @@
"bug_numbers": [1434852], "bug_numbers": [1434852],
"description": "DNS: lookup algorithm" "description": "DNS: lookup algorithm"
}, },
"DNS_LOOKUP_DISPOSITION": { "DNS_LOOKUP_DISPOSITION2": {
"record_in_processes": ["main"], "record_in_processes": ["main"],
"products": ["firefox", "fennec", "geckoview"], "products": ["firefox", "fennec", "geckoview"],
"alert_emails": ["necko@mozilla.com"], "alert_emails": ["necko@mozilla.com"],
"expires_in_version": "never", "expires_in_version": "never",
"kind": "categorical", "kind": "categorical",
"keyed": true,
"labels": ["trrOK", "trrFail", "trrAOK", "trrAFail", "labels": ["trrOK", "trrFail", "trrAOK", "trrAFail",
"trrAAAAOK", "trrAAAAFail", "osOK", "osFail"], "trrAAAAOK", "trrAAAAFail", "osOK", "osFail"],
"bug_numbers": [1434852], "bug_numbers": [1434852, 1640867],
"releaseChannelCollection": "opt-out", "releaseChannelCollection": "opt-out",
"description": "DNS: lookup algorithm" "description": "DNS: lookup algorithm; Keyed by TRR auto-detected"
}, },
"DNS_RENEWAL_TIME": { "DNS_RENEWAL_TIME": {
"record_in_processes": ["main"], "record_in_processes": ["main"],