bug 1406391 - Lock toolkit.telemetry.enabled based on channel r=froydnj
☠☠ backed out by ad08d9064a7d ☠ ☠
authorChris H-C <chutten@mozilla.com>
Fri, 13 Oct 2017 16:17:18 -0400 (2017-10-13)
changeset 388765 e1f34ba9cecc93f5e44c4d91c50929d46d4a59b2
parent 388764 e7f095ae94d8ac5583248e56d1e3cb995600b0ca
child 388766 15d959b9123e45fd13645866199e5046fd6c2ae5
push id32758
push userarchaeopteryx@coole-files.de
push dateFri, 27 Oct 2017 21:31:24 +0000 (2017-10-27)
treeherdermozilla-central@d58424c244c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1406391
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1406391 - Lock toolkit.telemetry.enabled based on channel r=froydnj In Unified Telemetry toolkit.telemetry.enabled controls whether we send base collection data or extended collection. The difference is mostly in volume, not in kind (though extended collection has a little stricter testing and monitoring requirements). Since the Preferences UI change in Firefox 56, users no longer have the ability to change toolkit.telemetry.enabled. This is a good thing as for pre-release users very few disabled extended collection, and even fewer release users enabled it. This provides uniform collection based on channel which should eventually net us some efficiencies. Until then we need to align our use of the toolkit.telemetry.enabled pref with the UI change that has already shipped. This is accomplished by locking t.t.e to 'true' on pre-release channels and locking it to 'false' on everything else. This doesn't apply to Android as it doesn't (yet) use Unified Telemetry. t.t.e means something rather different there. MozReview-Commit-ID: EOpWm8b0jWA
modules/libpref/Preferences.cpp
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -4770,16 +4770,17 @@ pref_InitInitialObjects()
       }
     }
   }
 
   rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST);
   NS_ENSURE_SUCCESS(
     rv, Err("pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST) failed"));
 
+#ifdef MOZ_WIDGET_ANDROID
   // Set up the correct default for toolkit.telemetry.enabled. If this build
   // has MOZ_TELEMETRY_ON_BY_DEFAULT *or* we're on the beta channel, telemetry
   // is on by default, otherwise not. This is necessary so that beta users who
   // are testing final release builds don't flipflop defaults.
   if (Preferences::GetDefaultType(kTelemetryPref) ==
       nsIPrefBranch::PREF_INVALID) {
     bool prerelease = false;
 #ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
@@ -4788,16 +4789,29 @@ pref_InitInitialObjects()
     nsAutoCString prefValue;
     Preferences::GetDefaultCString(kChannelPref, prefValue);
     if (prefValue.EqualsLiteral("beta")) {
       prerelease = true;
     }
 #endif
     PREF_SetBoolPref(kTelemetryPref, prerelease, true);
   }
+#else
+  // For platforms with Unified Telemetry (here meaning not-Android),
+  // toolkit.telemetry.enabled determines whether we send "extended" data.
+  // We only want extended data from pre-release channels due to size.
+  if (!strcmp(NS_STRINGIFY(MOZ_UPDATE_CHANNEL), "nightly") ||
+      !strcmp(NS_STRINGIFY(MOZ_UPDATE_CHANNEL), "aurora") ||
+      !strcmp(NS_STRINGIFY(MOZ_UPDATE_CHANNEL), "beta")) {
+    PREF_SetBoolPref(kTelemetryPref, true, true);
+  } else {
+    PREF_SetBoolPref(kTelemetryPref, false, true);
+  }
+  PREF_LockPref(kTelemetryPref, true);
+#endif // MOZ_WIDGET_ANDROID
 
   NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID,
                                 nullptr,
                                 NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID);
 
   nsCOMPtr<nsIObserverService> observerService =
     mozilla::services::GetObserverService();
   NS_ENSURE_SUCCESS(rv, Err("GetObserverService() failed (2)"));