Bug 756152 - disable persistent telemetry sending; r=taras a=akeybl
authorNathan Froyd <froydnj@mozilla.com>
Thu, 17 May 2012 14:58:48 -0400
changeset 94349 7bb1691988a5ff8ab52b3c50d855f6b50645a1b6
parent 94348 9620de534159e6d6575ca482fbc2053186022f4d
child 94350 38cf9bdc6fea8f01d55188f651fbe4ff088ad08e
push id1344
push usernfroyd@mozilla.com
push dateTue, 22 May 2012 18:48:08 +0000
treeherdermozilla-aurora@7bb1691988a5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstaras, akeybl
bugs756152
milestone14.0a2
Bug 756152 - disable persistent telemetry sending; r=taras a=akeybl
toolkit/components/telemetry/TelemetryPing.js
toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
--- a/toolkit/components/telemetry/TelemetryPing.js
+++ b/toolkit/components/telemetry/TelemetryPing.js
@@ -185,16 +185,18 @@ TelemetryPing.prototype = {
   _prevValues: {},
   // Generate a unique id once per session so the server can cope with
   // duplicate submissions.
   _uuid: generateUUID(),
   // Regex that matches histograms we carea bout during startup.
   _startupHistogramRegex: /SQLITE|HTTP|SPDY|CACHE|DNS/,
   _slowSQLStartup: {},
   _prevSession: null,
+  // Bug 756152
+  _disablePersistentTelemetrySending: true,
 
   /**
    * When reflecting a histogram into JS, Telemetry hands us an object
    * with the following properties:
    * 
    * - min, max, histogram_type, sum: simple integers;
    * - counts: array of counts for histogram buckets;
    * - ranges: array of calculated bucket sizes.
@@ -635,16 +637,20 @@ TelemetryPing.prototype = {
       self.gatherMemory();
       delete self._timer
     }
     this._timer.initWithCallback(timerCallback, TELEMETRY_DELAY, Ci.nsITimer.TYPE_ONE_SHOT);
     this.loadHistograms(this.savedHistogramsFile(), false);
   },
 
   loadHistograms: function loadHistograms(file, sync) {
+    if (this._disablePersistentTelemetrySending) {
+      return;
+    }
+
     let self = this;
     let loadCallback = function(data) {
       self._prevSession = data;
     }
     Telemetry.loadHistograms(file, loadCallback, sync);
   },
 
   /** 
@@ -722,16 +728,19 @@ TelemetryPing.prototype = {
     case "test-save-histograms":
       Telemetry.saveHistograms(aSubject.QueryInterface(Ci.nsILocalFile),
                                aData, function (success) success,
                                /*isSynchronous=*/true);
       break;
     case "test-load-histograms":
       this.loadHistograms(aSubject.QueryInterface(Ci.nsILocalFile), true);
       break;
+    case "test-enable-persistent-telemetry-send":
+      this._disablePersistentTelemetrySending = false;
+      break;
     case "test-ping":
       server = aData;
       // fall through
     case "idle":
       if (this._isIdleObserver) {
         idleService.removeIdleObserver(this, IDLE_TIMEOUT_SECONDS);
         this._isIdleObserver = false;
       }
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
@@ -27,16 +27,17 @@ const BinaryInputStream = Components.Con
 const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
 
 var httpserver = new nsHttpServer();
 var gFinished = false;
 
 function telemetry_ping () {
   const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsIObserver);
   TelemetryPing.observe(null, "test-gather-startup", null);
+  TelemetryPing.observe(null, "test-enable-persistent-telemetry-send", null);
   TelemetryPing.observe(null, "test-ping", SERVER);
 }
 
 function nonexistentServerObserver(aSubject, aTopic, aData) {
   Services.obs.removeObserver(nonexistentServerObserver, aTopic);
 
   httpserver.start(4444);