Bug 1200164 - Only do isOfficialTelemetry checks for Telemetry uploads. r=dexter
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Fri, 18 Dec 2015 19:35:05 +0700
changeset 278608 762e4af55ba2e1c6edf0eb21e7ae50466cc2f80d
parent 278607 027e623f8f26cc2e259eb548213c9c67ab9f08b5
child 278609 444097473d1a78553a360b82a2d123cfad306492
push id16878
push usergeorg.fritzsche@googlemail.com
push dateWed, 06 Jan 2016 09:46:33 +0000
treeherderfx-team@762e4af55ba2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdexter
bugs1200164
milestone46.0a1
Bug 1200164 - Only do isOfficialTelemetry checks for Telemetry uploads. r=dexter
toolkit/components/telemetry/TelemetryController.jsm
toolkit/components/telemetry/TelemetrySession.jsm
toolkit/components/telemetry/docs/preferences.rst
--- a/toolkit/components/telemetry/TelemetryController.jsm
+++ b/toolkit/components/telemetry/TelemetryController.jsm
@@ -666,29 +666,17 @@ var Impl = {
 
     // Configure base Telemetry recording.
     // Unified Telemetry makes it opt-out unless the unifedOptin pref is set.
     // Additionally, we make Telemetry opt-out for a 5% sample.
     // If extended Telemetry is enabled, base recording is always on as well.
     const enabled = Utils.isTelemetryEnabled;
     const isOptout = IS_UNIFIED_TELEMETRY && (!Policy.isUnifiedOptin() || this._isInOptoutSample());
     Telemetry.canRecordBase = enabled || isOptout;
-
-    if (AppConstants.MOZILLA_OFFICIAL) {
-      // Enable extended telemetry if:
-      //  * the telemetry preference is set and
-      //  * this is an official build or we are in test-mode
-      // We only do the latter check for official builds so that e.g. developer builds
-      // still enable Telemetry based on prefs.
-      Telemetry.canRecordExtended = enabled && (Telemetry.isOfficialTelemetry || this._testMode);
-    } else {
-      // Turn off extended telemetry recording if disabled by preferences or if base/telemetry
-      // telemetry recording is off.
-      Telemetry.canRecordExtended = enabled;
-    }
+    Telemetry.canRecordExtended = enabled;
 
     this._log.config("enableTelemetryRecording - canRecordBase:" + Telemetry.canRecordBase +
                      ", canRecordExtended: " + Telemetry.canRecordExtended);
 
     return Telemetry.canRecordBase;
   },
 
   /**
--- a/toolkit/components/telemetry/TelemetrySession.jsm
+++ b/toolkit/components/telemetry/TelemetrySession.jsm
@@ -1677,19 +1677,17 @@ var Impl = {
     case "app-startup":
       // app-startup is only registered for content processes.
       return this.setupContentProcess();
     case "content-child-shutdown":
       // content-child-shutdown is only registered for content processes.
       Services.obs.removeObserver(this, "content-child-shutdown");
       this.uninstall();
 
-      if (Telemetry.isOfficialTelemetry) {
-        this.sendContentProcessPing(REASON_SAVED_SESSION);
-      }
+      this.sendContentProcessPing(REASON_SAVED_SESSION);
       break;
     case TOPIC_CYCLE_COLLECTOR_BEGIN:
       let now = new Date();
       if (!gLastMemoryPoll
           || (TELEMETRY_INTERVAL <= now - gLastMemoryPoll)) {
         gLastMemoryPoll = now;
         this.gatherMemory();
       }
@@ -1736,25 +1734,23 @@ var Impl = {
       //    the file that we saved will be deleted by the usual process in
       //    finishPingRequest after it is submitted.
       // 3) We submit the data, and then come back into the foreground. Same as case (2).
       // 4) We do not submit the data, but come back into the foreground. In this case
       //    we have the option of either deleting the file that we saved (since we will either
       //    send the live data while in the foreground, or create the file again on the next
       //    backgrounding), or not (in which case we will delete it on submit, or overwrite
       //    it on the next backgrounding). Not deleting it is faster, so that's what we do.
-      if (Telemetry.isOfficialTelemetry) {
-        let payload = this.getSessionPayload(REASON_SAVED_SESSION, false);
-        let options = {
-          addClientId: true,
-          addEnvironment: true,
-          overwrite: true,
-        };
-        TelemetryController.addPendingPing(getPingType(payload), payload, options);
-      }
+      let payload = this.getSessionPayload(REASON_SAVED_SESSION, false);
+      let options = {
+        addClientId: true,
+        addEnvironment: true,
+        overwrite: true,
+      };
+      TelemetryController.addPendingPing(getPingType(payload), payload, options);
       break;
     }
   },
 
   /**
    * This tells TelemetrySession to uninitialize and save any pending pings.
    * @param testing Optional. If true, always saves the ping whether Telemetry
    *                can send pings or not, which is used for testing.
@@ -1769,27 +1765,25 @@ var Impl = {
       }
       this.uninstall();
 
       let reset = () => {
         this._initStarted = false;
         this._initialized = false;
       };
 
-      if (Telemetry.isOfficialTelemetry || testing) {
-        return Task.spawn(function*() {
-          yield this.saveShutdownPings();
+      return Task.spawn(function*() {
+        yield this.saveShutdownPings();
 
-          if (IS_UNIFIED_TELEMETRY) {
-            yield TelemetryController.removeAbortedSessionPing();
-          }
+        if (IS_UNIFIED_TELEMETRY) {
+          yield TelemetryController.removeAbortedSessionPing();
+        }
 
-          reset();
-        }.bind(this));
-      }
+        reset();
+      }.bind(this));
 
       reset();
       return Promise.resolve();
     };
 
     // We can be in one the following states here:
     // 1) setupChromeProcess was never called
     // or it was called and
--- a/toolkit/components/telemetry/docs/preferences.rst
+++ b/toolkit/components/telemetry/docs/preferences.rst
@@ -1,18 +1,18 @@
 Preferences
 ===========
 
 Telemetry behaviour is controlled through the preferences listed here.
 
 Default behaviors
 -----------------
 
-On official builds (which define ``MOZILLA_OFFICIAL``), Telemetry is only initialized when ``MOZ_TELEMETRY_REPORTING`` is defined.
-Sending only happens on official builds with ``MOZ_TELEMETRY_REPORTING`` defined.
+Sending only happens on official builds (i.e. with ``MOZILLA_OFFICIAL``set) with ``MOZ_TELEMETRY_REPORTING`` defined.
+All other builds drop all outgoing pings, so they will also not retry sending them later.
 
 Preferences
 -----------
 
 ``toolkit.telemetry.unified``
 
   This controls whether unified behavior is enabled. If true: