Bug 1074789 - Adjust DNS renewal time telemetry to take TTL experiments into consideration r=mcmanus

This commit is contained in:
Steve Workman 2014-10-07 14:57:48 -07:00
parent 0bc6f1b8fb
commit 43b0e6a90e
2 changed files with 94 additions and 6 deletions

View File

@ -266,6 +266,47 @@ GetBlacklistCountHistogram(DnsExpirationVariant aVariant,
return DNS_BLACKLIST_COUNT_VAR_CONTROL_LOW;
}
static mozilla::Telemetry::ID
GetRenewalTimeHistogram(DnsExpirationVariant aVariant)
{
using namespace mozilla::Telemetry;
#ifdef TTL_AVAILABLE
switch (sDnsVariant) {
case DNS_EXP_VARIANT_CONTROL:
return DNS_RENEWAL_TIME;
case DNS_EXP_VARIANT_TTL_ONLY:
return DNS_RENEWAL_TIME__TTL_ONLY_EXPT;
case DNS_EXP_VARIANT_TTL_PLUS_CONST_GRACE:
return DNS_RENEWAL_TIME__TTL_PLUS_CONST_GRACE_EXPT;
default:
MOZ_ASSERT_UNREACHABLE("Invalid variant.");
}
#endif
return DNS_RENEWAL_TIME;
}
static mozilla::Telemetry::ID
GetRenewalTimeForTTLHistogram(DnsExpirationVariant aVariant)
{
using namespace mozilla::Telemetry;
#ifdef TTL_AVAILABLE
switch (sDnsVariant) {
case DNS_EXP_VARIANT_CONTROL:
MOZ_ASSERT_UNREACHABLE("No TTL for Control Expt.");
return DNS_RENEWAL_TIME;
case DNS_EXP_VARIANT_TTL_ONLY:
return DNS_RENEWAL_TIME_FOR_TTL__TTL_ONLY_EXPT;
case DNS_EXP_VARIANT_TTL_PLUS_CONST_GRACE:
return DNS_RENEWAL_TIME_FOR_TTL__TTL_PLUS_CONST_GRACE_EXPT;
default:
MOZ_ASSERT_UNREACHABLE("Invalid variant.");
}
#endif
return DNS_RENEWAL_TIME;
}
// this macro filters out any flags that are not used when constructing the
// host key. the significant flags are those that would affect the resulting
// host record (i.e., the flags that are passed down to PR_GetAddrInfoByName).
@ -1610,12 +1651,19 @@ nsHostResolver::ThreadFunc(void *arg)
uint32_t millis = static_cast<uint32_t>(elapsed.ToMilliseconds());
if (NS_SUCCEEDED(status)) {
Telemetry::Accumulate(!rec->addr_info_gencnt ?
Telemetry::DNS_LOOKUP_TIME :
Telemetry::DNS_RENEWAL_TIME,
millis);
}
else {
Telemetry::ID histogramID;
if (!rec->addr_info_gencnt) {
// Time for initial lookup.
histogramID = Telemetry::DNS_LOOKUP_TIME;
} else if (!getTtl) {
// Time for renewal; categorized by expiration strategy.
histogramID = GetRenewalTimeHistogram(sDnsVariant);
} else {
// Time to get TTL; categorized by expiration strategy.
histogramID = GetRenewalTimeForTTLHistogram(sDnsVariant);
}
Telemetry::Accumulate(histogramID, millis);
} else {
Telemetry::Accumulate(Telemetry::DNS_FAILED_LOOKUP_TIME, millis);
}

View File

@ -2145,6 +2145,46 @@
"extended_statistics_ok": true,
"description": "Time for a renewed DNS OS resolution (msec)"
},
"DNS_RENEWAL_TIME_FOR_TTL": {
"expires_in_version": "never",
"kind": "exponential",
"high": "60000",
"n_buckets": 50,
"extended_statistics_ok": true,
"description": "Time for a DNS OS resolution (msec) used to get TTL"
},
"DNS_RENEWAL_TIME_FOR_TTL__TTL_ONLY_EXPT": {
"expires_in_version": "never",
"kind": "exponential",
"high": "60000",
"n_buckets": 50,
"extended_statistics_ok": true,
"description": "Time for a DNS OS resolution (msec) used to get TTL - TTL Only Experiment"
},
"DNS_RENEWAL_TIME_FOR_TTL__TTL_PLUS_CONST_GRACE_EXPT": {
"expires_in_version": "never",
"kind": "exponential",
"high": "60000",
"n_buckets": 50,
"extended_statistics_ok": true,
"description": "Time for a DNS OS resolution (msec) used to get TTL - TTL + Const Grace Period Experiment"
},
"DNS_RENEWAL_TIME__TTL_ONLY_EXPT": {
"expires_in_version": "never",
"kind": "exponential",
"high": "60000",
"n_buckets": 50,
"extended_statistics_ok": true,
"description": "Time for a renewed DNS OS resolution (msec) - TTL Only Experiment"
},
"DNS_RENEWAL_TIME__TTL_PLUS_CONST_GRACE_EXPT": {
"expires_in_version": "never",
"kind": "exponential",
"high": "60000",
"n_buckets": 50,
"extended_statistics_ok": true,
"description": "Time for a renewed DNS OS resolution (msec) - TTL + Const Grace Period Experiment"
},
"DNS_FAILED_LOOKUP_TIME": {
"expires_in_version": "never",
"kind": "exponential",