Bug 1415625 - Use Telemetry::CanRecordPreReleaseData instead of toolkit.telemetry.enabled. Remove network.allow-experiments because it is not used. r=michal

Differential Revision: https://phabricator.services.mozilla.com/D12745

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dragana Damjanovic 2018-12-18 17:19:29 +00:00
Родитель 7fd9558a09
Коммит 2ebce46fd8
8 изменённых файлов: 25 добавлений и 72 удалений

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

@ -1603,11 +1603,6 @@ pref("logging.config.clear_on_startup", true);
// prevents necko connecting to ports 1-5 unless the protocol
// overrides.
// Allow necko to do A/B testing. Will generally only happen if
// telemetry is also enabled as otherwise there is no way to report
// the results
pref("network.allow-experiments", true);
// Allow the network changed event to get sent when a network topology or
// setup change is noticed while running.
pref("network.notify.changed", true);

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

@ -54,7 +54,6 @@ static Atomic<PRThread *, Relaxed> gSocketThread;
#define POLL_BUSY_WAIT_PERIOD "network.sts.poll_busy_wait_period"
#define POLL_BUSY_WAIT_PERIOD_TIMEOUT \
"network.sts.poll_busy_wait_period_timeout"
#define TELEMETRY_PREF "toolkit.telemetry.enabled"
#define MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN \
"network.sts.max_time_for_pr_close_during_shutdown"
#define POLLABLE_EVENT_TIMEOUT "network.sts.pollable_event_timeout"
@ -142,7 +141,6 @@ nsSocketTransportService::nsSocketTransportService()
mPollableEventTimeout(TimeDuration::FromSeconds(6)),
mServingPendingQueue(false),
mMaxTimePerPollIter(100),
mTelemetryEnabledPref(false),
mMaxTimeForPrClosePref(PR_SecondsToInterval(5)),
mLastNetworkLinkChangeTime(0),
mNetworkLinkChangeBusyWaitPeriod(PR_SecondsToInterval(50)),
@ -287,7 +285,7 @@ bool nsSocketTransportService::CanAttachSocket() {
uint32_t total = mActiveCount + mIdleCount;
bool rv = total < gMaxCount;
if (mTelemetryEnabledPref &&
if (Telemetry::CanRecordPrereleaseData() &&
(((total >= 900) || !rv) && !reported900FDLimit)) {
reported900FDLimit = true;
Telemetry::Accumulate(Telemetry::NETWORK_SESSION_AT_900FD, true);
@ -538,7 +536,7 @@ int32_t nsSocketTransportService::Poll(TimeDuration *pollDuration,
}
TimeStamp pollStart;
if (mTelemetryEnabledPref) {
if (Telemetry::CanRecordPrereleaseData()) {
pollStart = TimeStamp::NowLoRes();
}
@ -556,7 +554,7 @@ int32_t nsSocketTransportService::Poll(TimeDuration *pollDuration,
return PR_Poll(pollList, pollCount, pollTimeout);
}();
if (mTelemetryEnabledPref && !pollStart.IsNull()) {
if (Telemetry::CanRecordPrereleaseData() && !pollStart.IsNull()) {
*pollDuration = TimeStamp::NowLoRes() - pollStart;
}
@ -581,7 +579,6 @@ static const char *gCallbackPrefs[] = {
KEEPALIVE_RETRY_INTERVAL_PREF,
KEEPALIVE_PROBE_COUNT_PREF,
MAX_TIME_BETWEEN_TWO_POLLS,
TELEMETRY_PREF,
MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN,
POLLABLE_EVENT_TIMEOUT,
ESNI_ENABLED,
@ -961,20 +958,20 @@ nsSocketTransportService::Run() {
numberOfPendingEvents = 0;
numberOfPendingEventsLastCycle = 0;
if (mTelemetryEnabledPref) {
if (Telemetry::CanRecordPrereleaseData()) {
startOfCycleForLastCycleCalc = TimeStamp::NowLoRes();
startOfNextIteration = TimeStamp::NowLoRes();
}
pollDuration = nullptr;
do {
if (mTelemetryEnabledPref) {
if (Telemetry::CanRecordPrereleaseData()) {
pollCycleStart = TimeStamp::NowLoRes();
}
DoPollIteration(&singlePollDuration);
if (mTelemetryEnabledPref && !pollCycleStart.IsNull()) {
if (Telemetry::CanRecordPrereleaseData() && !pollCycleStart.IsNull()) {
Telemetry::Accumulate(Telemetry::STS_POLL_BLOCK_TIME,
singlePollDuration.ToMilliseconds());
Telemetry::AccumulateTimeDelta(Telemetry::STS_POLL_CYCLE,
@ -1001,7 +998,7 @@ nsSocketTransportService::Run() {
mServingPendingQueue = true;
}
if (mTelemetryEnabledPref) {
if (Telemetry::CanRecordPrereleaseData()) {
startOfIteration = startOfNextIteration;
// Everything that comes after this point will
// be served in the next iteration. If no even
@ -1020,7 +1017,7 @@ nsSocketTransportService::Run() {
((TimeStamp::NowLoRes() - eventQueueStart).ToMilliseconds() <
mMaxTimePerPollIter));
if (mTelemetryEnabledPref && !mServingPendingQueue &&
if (Telemetry::CanRecordPrereleaseData() && !mServingPendingQueue &&
!startOfIteration.IsNull()) {
Telemetry::AccumulateTimeDelta(Telemetry::STS_POLL_AND_EVENTS_CYCLE,
startOfIteration + pollDuration,
@ -1041,7 +1038,8 @@ nsSocketTransportService::Run() {
{
MutexAutoLock lock(mLock);
if (mShuttingDown) {
if (mTelemetryEnabledPref && !startOfCycleForLastCycleCalc.IsNull()) {
if (Telemetry::CanRecordPrereleaseData() &&
!startOfCycleForLastCycleCalc.IsNull()) {
Telemetry::Accumulate(
Telemetry::STS_NUMBER_OF_PENDING_EVENTS_IN_THE_LAST_CYCLE,
numberOfPendingEventsLastCycle);
@ -1224,7 +1222,7 @@ nsresult nsSocketTransportService::DoPollIteration(TimeDuration *pollDuration) {
s.MaybeResetEpoch();
}
}
if (mTelemetryEnabledPref) {
if (Telemetry::CanRecordPrereleaseData()) {
Telemetry::Accumulate(Telemetry::STS_NUMBER_OF_ONSOCKETREADY_CALLS,
numberOfOnSocketReadyCalls);
}
@ -1331,12 +1329,6 @@ nsresult nsSocketTransportService::UpdatePrefs() {
PR_SecondsToInterval(pollBusyWaitPeriodTimeout);
}
bool telemetryPref = false;
rv = Preferences::GetBool(TELEMETRY_PREF, &telemetryPref);
if (NS_SUCCEEDED(rv)) {
mTelemetryEnabledPref = telemetryPref;
}
int32_t maxTimeForPrClosePref;
rv = Preferences::GetInt(MAX_TIME_FOR_PR_CLOSE_DURING_SHUTDOWN,
&maxTimeForPrClosePref);
@ -1646,6 +1638,13 @@ void nsSocketTransportService::GetSocketConnections(
AnalyzeConnection(data, &mIdleList[i], false);
}
bool
nsSocketTransportService::IsTelemetryEnabledAndNotSleepPhase()
{
return Telemetry::CanRecordPrereleaseData() &&
!mSleepPhase;
}
#if defined(XP_WIN)
void nsSocketTransportService::StartPollWatchdog() {
// Start off the timer from a runnable off of the main thread in order to

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

@ -114,9 +114,7 @@ class nsSocketTransportService final : public nsPISocketTransportService,
// Returns true if keepalives are enabled in prefs.
bool IsKeepaliveEnabled() { return mKeepaliveEnabledPref; }
bool IsTelemetryEnabledAndNotSleepPhase() {
return mTelemetryEnabledPref && !mSleepPhase;
}
bool IsTelemetryEnabledAndNotSleepPhase();
PRIntervalTime MaxTimeForPrClosePref() { return mMaxTimeForPrClosePref; }
bool IsEsniEnabled() {
@ -260,7 +258,6 @@ class nsSocketTransportService final : public nsPISocketTransportService,
Atomic<bool> mServingPendingQueue;
Atomic<int32_t, Relaxed> mMaxTimePerPollIter;
Atomic<bool, Relaxed> mTelemetryEnabledPref;
Atomic<PRIntervalTime, Relaxed> mMaxTimeForPrClosePref;
// Timestamp of the last network link change event, tracked
// also on child processes.

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

@ -1243,7 +1243,7 @@ HttpBaseChannel::DoApplyContentConversions(nsIStreamListener* aNextListener,
}
LOG(("converter removed '%s' content-encoding\n", val));
if (gHttpHandler->IsTelemetryEnabled()) {
if (Telemetry::CanRecordPrereleaseData()) {
int mode = 0;
if (from.EqualsLiteral("gzip") || from.EqualsLiteral("x-gzip")) {
mode = 1;

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

@ -2133,7 +2133,7 @@ nsresult nsHttpChannel::ProcessResponse() {
mConnectionInfo->EndToEndSSL());
}
if (gHttpHandler->IsTelemetryEnabled()) {
if (Telemetry::CanRecordPrereleaseData()) {
// how often do we see something like Alt-Svc: "443:quic,p=1"
nsAutoCString alt_service;
Unused << mResponseHead->GetHeader(nsHttp::Alternate_Service, alt_service);
@ -2502,7 +2502,7 @@ nsresult nsHttpChannel::ContinueProcessResponse2(nsresult rv) {
}
}
if (gHttpHandler->IsTelemetryEnabled()) {
if (Telemetry::CanRecordPrereleaseData()) {
CacheDisposition cacheDisposition;
if (!mDidReval) {
cacheDisposition = kCacheMissed;

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

@ -794,7 +794,7 @@ nsresult nsHttpChannelAuthProvider::GetCredentialsForChallenge(
// Collect statistics on how frequently the various types of HTTP
// authentication are used over SSL and non-SSL connections.
if (gHttpHandler->IsTelemetryEnabled()) {
if (Telemetry::CanRecordPrereleaseData()) {
if (NS_LITERAL_CSTRING("basic").LowerCaseEqualsASCII(authType)) {
Telemetry::Accumulate(
Telemetry::HTTP_AUTH_TYPE_STATS,
@ -943,7 +943,7 @@ bool nsHttpChannelAuthProvider::BlockPrompt(bool proxyAuth) {
}
}
if (gHttpHandler->IsTelemetryEnabled()) {
if (Telemetry::CanRecordPrereleaseData()) {
if (topDoc) {
Telemetry::Accumulate(Telemetry::HTTP_AUTH_DIALOG_STATS_3,
HTTP_AUTH_DIALOG_TOP_LEVEL_DOC);

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

@ -103,8 +103,6 @@
#define BROWSER_PREF_PREFIX "browser.cache."
#define DONOTTRACK_HEADER_ENABLED "privacy.donottrackheader.enabled"
#define H2MANDATORY_SUITE "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256"
#define TELEMETRY_ENABLED "toolkit.telemetry.enabled"
#define ALLOW_EXPERIMENTS "network.allow-experiments"
#define SAFE_HINT_HEADER_VALUE "safeHint.enabled"
#define SECURITY_PREFIX "security."
@ -245,8 +243,6 @@ nsHttpHandler::nsHttpHandler()
mSafeHintEnabled(false),
mParentalControlEnabled(false),
mHandlerActive(false),
mTelemetryEnabled(false),
mAllowExperiments(true),
mDebugObservations(false),
mEnableSpdy(false),
mHttp2Enabled(true),
@ -430,7 +426,6 @@ static const char *gCallbackPrefs[] = {
INTL_ACCEPT_LANGUAGES,
BROWSER_PREF("disk_cache_ssl"),
DONOTTRACK_HEADER_ENABLED,
TELEMETRY_ENABLED,
H2MANDATORY_SUITE,
HTTP_PREF("tcp_keepalive.short_lived_connections"),
HTTP_PREF("tcp_keepalive.long_lived_connections"),
@ -1762,19 +1757,6 @@ void nsHttpHandler::PrefsChanged(const char *pref) {
// includes telemetry and allow-experiments because of the abtest profile
bool requestTokenBucketUpdated = false;
//
// Telemetry
//
if (PREF_CHANGED(TELEMETRY_ENABLED)) {
cVar = false;
requestTokenBucketUpdated = true;
rv = Preferences::GetBool(TELEMETRY_ENABLED, &cVar);
if (NS_SUCCEEDED(rv)) {
mTelemetryEnabled = cVar;
}
}
// "security.ssl3.ecdhe_rsa_aes_128_gcm_sha256" is the required h2 interop
// suite.
@ -1786,18 +1768,6 @@ void nsHttpHandler::PrefsChanged(const char *pref) {
}
}
//
// network.allow-experiments
//
if (PREF_CHANGED(ALLOW_EXPERIMENTS)) {
cVar = true;
requestTokenBucketUpdated = true;
rv = Preferences::GetBool(ALLOW_EXPERIMENTS, &cVar);
if (NS_SUCCEEDED(rv)) {
mAllowExperiments = cVar;
}
}
// network.http.debug-observations
if (PREF_CHANGED("network.http.debug-observations")) {
cVar = false;

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

@ -105,9 +105,7 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
bool IsPersistentHttpsCachingEnabled() {
return mEnablePersistentHttpsCaching;
}
bool IsTelemetryEnabled() { return mTelemetryEnabled; }
bool AllowExperiments() { return mTelemetryEnabled && mAllowExperiments; }
bool IsSpdyEnabled() { return mEnableSpdy; }
bool IsHttp2Enabled() { return mHttp2Enabled; }
bool EnforceHttp2TlsProfile() { return mEnforceHttp2TlsProfile; }
@ -547,12 +545,6 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
// true in between init and shutdown states
Atomic<bool, Relaxed> mHandlerActive;
// Whether telemetry is reported or not
uint32_t mTelemetryEnabled : 1;
// The value of network.allow-experiments
uint32_t mAllowExperiments : 1;
// The value of 'hidden' network.http.debug-observations : 1;
uint32_t mDebugObservations : 1;