Bug 756152 - disable persistent telemetry sending; r=taras
authorNathan Froyd <froydnj@mozilla.com>
Thu, 17 May 2012 14:58:48 -0400
changeset 94491 82154680bc6a9dbca6ba6fd2c36878804d2f8734
parent 94490 adbbcd1cd7eb3e601564744c107d50d4b4bd5bad
child 94492 1265b2604f438a6bf934011f26d8c905e095d1d3
push id9636
push usernfroyd@mozilla.com
push dateMon, 21 May 2012 14:36:39 +0000
treeherdermozilla-inbound@82154680bc6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstaras
bugs756152
milestone15.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 756152 - disable persistent telemetry sending; r=taras
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
@@ -168,16 +168,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.
@@ -638,16 +640,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);
   },
 
   /** 
@@ -725,16 +731,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
@@ -29,16 +29,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);