Bug 1253633 - Don't put the TELEMETRY_TEST_* histograms into the Telemetry payload outside of tests; r?gfritzsche draft
authorRob Wood <rwood@mozilla.com>
Mon, 14 Mar 2016 14:45:33 -0400
changeset 340010 747a714ea3be057355b2baa6f860a9d024534eac
parent 339619 02012e498a7992b0eaf83d9fcb7ccc86355d89d3
child 516114 9e101afef108d9b2eec4293e08da92e687d7624f
push id12872
push userrwood@mozilla.com
push dateMon, 14 Mar 2016 18:49:54 +0000
reviewersgfritzsche
bugs1253633
milestone48.0a1
Bug 1253633 - Don't put the TELEMETRY_TEST_* histograms into the Telemetry payload outside of tests; r?gfritzsche MozReview-Commit-ID: EARcnYivHno
toolkit/components/telemetry/TelemetrySession.jsm
--- a/toolkit/components/telemetry/TelemetrySession.jsm
+++ b/toolkit/components/telemetry/TelemetrySession.jsm
@@ -890,18 +890,19 @@ var Impl = {
       Telemetry.registeredHistograms(this.getDatasetType(), []);
     let hls = subsession ? Telemetry.snapshotSubsessionHistograms(clearSubsession)
                          : Telemetry.histogramSnapshots;
     let ret = {};
 
     for (let name of registered) {
       for (let n of [name, "STARTUP_" + name]) {
         if (n in hls) {
+          // omit telemetry test histograms from the payload if testing flag is not set
           if (n.indexOf('TELEMETRY_TEST_') == 0 && this._testing == false) {
-            this._log.trace('not testing, skipping ' + n);
+            this._log.trace("getHistograms - Skipping test histogram: " + n);
           } else {
             ret[n] = this.packHistogram(hls[n]);
           }
         }
       }
     }
 
     return ret;
@@ -929,31 +930,32 @@ var Impl = {
   getKeyedHistograms: function(subsession, clearSubsession) {
     this._log.trace("getKeyedHistograms - subsession: " + subsession + ", clearSubsession: " + clearSubsession);
 
     let registered =
       Telemetry.registeredKeyedHistograms(this.getDatasetType(), []);
     let ret = {};
 
     for (let id of registered) {
+      // omit telemetry test histograms from the payload if testing flag is not set
       if (id.indexOf('TELEMETRY_TEST_') == 0 && this._testing == false) {
-        this._log.trace('not testing, skipping ' + id);
+        this._log.trace("getKeyedHistograms - Skipping test histogram: " + id);
+        continue;
+      }
+      ret[id] = {};
+      let keyed = Telemetry.getKeyedHistogramById(id);
+      let snapshot = null;
+      if (subsession) {
+        snapshot = clearSubsession ? keyed.snapshotSubsessionAndClear()
+                                   : keyed.subsessionSnapshot();
       } else {
-        ret[id] = {};
-        let keyed = Telemetry.getKeyedHistogramById(id);
-        let snapshot = null;
-        if (subsession) {
-          snapshot = clearSubsession ? keyed.snapshotSubsessionAndClear()
-                                     : keyed.subsessionSnapshot();
-        } else {
-          snapshot = keyed.snapshot();
-        }
-        for (let key of Object.keys(snapshot)) {
-          ret[id][key] = this.packHistogram(snapshot[key]);
-        }
+        snapshot = keyed.snapshot();
+      }
+      for (let key of Object.keys(snapshot)) {
+        ret[id][key] = this.packHistogram(snapshot[key]);
       }
     }
 
     return ret;
   },
 
   getThreadHangStats: function getThreadHangStats(stats) {
     this._log.trace("getThreadHangStats");