Bug 1381178 - Remove DEVTOOLS_MEMORY_ telemetry probes; r=jimb
authorGreg Tatum <gtatum@mozilla.com>
Fri, 15 Sep 2017 10:20:18 -0500
changeset 383091 8a4d117fef7b36ae4ce36e8a415a78bf0df2eea7
parent 383090 6408f36a3bdc0802c57728d634099c59dabd324e
child 383092 709e623173d8410e2845de600f3877c1b2259290
push id32583
push userarchaeopteryx@coole-files.de
push dateWed, 27 Sep 2017 09:46:12 +0000
treeherdermozilla-central@5563e7da39b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimb
bugs1381178
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 1381178 - Remove DEVTOOLS_MEMORY_ telemetry probes; r=jimb MozReview-Commit-ID: Ap7aMdlvsub
devtools/client/memory/actions/diffing.js
devtools/client/memory/actions/io.js
devtools/client/memory/actions/snapshot.js
devtools/client/memory/moz.build
devtools/client/memory/telemetry.js
--- a/devtools/client/memory/actions/diffing.js
+++ b/devtools/client/memory/actions/diffing.js
@@ -1,17 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { assert, reportException } = require("devtools/shared/DevToolsUtils");
 const { actions, diffingState, viewState } = require("../constants");
-const telemetry = require("../telemetry");
 const {
   getSnapshot,
   censusIsUpToDate,
   snapshotIsDiffable,
   findSelectedSnapshot,
 } = require("../utils");
 
 /**
@@ -107,18 +106,16 @@ const takeCensusDiff = exports.takeCensu
       type: actions.TAKE_CENSUS_DIFF_END,
       first,
       second,
       report,
       parentMap,
       filter,
       display,
     });
-
-    telemetry.countDiff({ filter, display });
   };
 };
 
 /**
  * Ensure that the current diffing data is up to date with the currently
  * selected display, filter, etc. If the state is not up-to-date, then a
  * recompute is triggered.
  *
--- a/devtools/client/memory/actions/io.js
+++ b/devtools/client/memory/actions/io.js
@@ -1,17 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 const { immutableUpdate, reportException, assert } = require("devtools/shared/DevToolsUtils");
 const { snapshotState: states, actions} = require("../constants");
 const { L10N, openFilePicker, createSnapshot } = require("../utils");
-const telemetry = require("../telemetry");
 const { OS } = require("resource://gre/modules/osfile.jsm");
 const {
   selectSnapshot,
   computeSnapshotData,
   readSnapshot
 } = require("./snapshot");
 const VALID_EXPORT_STATES = [states.SAVED, states.READ];
 
@@ -29,18 +28,16 @@ exports.pickFileAndExportSnapshot = func
     }
 
     yield dispatch(exportSnapshot(snapshot, outputFile.path));
   };
 };
 
 const exportSnapshot = exports.exportSnapshot = function (snapshot, dest) {
   return function* (dispatch, getState) {
-    telemetry.countExportSnapshot();
-
     dispatch({ type: actions.EXPORT_SNAPSHOT_START, snapshot });
 
     assert(VALID_EXPORT_STATES.includes(snapshot.state),
       `Snapshot is in invalid state for exporting: ${snapshot.state}`);
 
     try {
       yield OS.File.copy(snapshot.path, dest);
     } catch (error) {
@@ -65,18 +62,16 @@ exports.pickFileAndImportSnapshotAndCens
     }
 
     yield dispatch(importSnapshotAndCensus(heapWorker, input.path));
   };
 };
 
 const importSnapshotAndCensus = function (heapWorker, path) {
   return function* (dispatch, getState) {
-    telemetry.countImportSnapshot();
-
     const snapshot = immutableUpdate(createSnapshot(getState()), {
       path,
       state: states.IMPORTING,
       imported: true,
     });
     const id = snapshot.id;
 
     dispatch({ type: actions.IMPORT_SNAPSHOT_START, snapshot });
--- a/devtools/client/memory/actions/snapshot.js
+++ b/devtools/client/memory/actions/snapshot.js
@@ -15,17 +15,16 @@ const {
   actions,
   snapshotState: states,
   viewState,
   censusState,
   treeMapState,
   dominatorTreeState,
   individualsState,
 } = require("../constants");
-const telemetry = require("../telemetry");
 const view = require("./view");
 const refresh = require("./refresh");
 const diffing = require("./diffing");
 const TaskCache = require("./task-cache");
 
 /**
  * A series of actions are fired from this task to save, read and generate the
  * initial census from a snapshot.
@@ -96,18 +95,16 @@ exports.selectSnapshotAndRefresh = funct
 /**
  * Take a snapshot and return its id on success, or null on failure.
  *
  * @param {MemoryFront} front
  * @returns {Number|null}
  */
 const takeSnapshot = exports.takeSnapshot = function (front) {
   return function* (dispatch, getState) {
-    telemetry.countTakeSnapshot();
-
     if (getState().diffing || getState().individuals) {
       dispatch(view.changeView(viewState.CENSUS));
     }
 
     const snapshot = createSnapshot(getState());
     const id = snapshot.id;
     dispatch({ type: actions.TAKE_SNAPSHOT_START, snapshot });
     dispatch(selectSnapshot(id));
@@ -253,18 +250,16 @@ function makeTakeCensusTask({ getDisplay
       dispatch({
         type: endAction,
         id,
         display,
         filter,
         report,
         parentMap
       });
-
-      telemetry.countCensus({ filter, display });
     }
   });
 }
 
 /**
  * Take a census.
  */
 const takeCensus = exports.takeCensus = makeTakeCensusTask({
@@ -580,17 +575,16 @@ TaskCache.declareCacheableTask({
         dispatch({ type: actions.DOMINATOR_TREE_ERROR, id, error });
         return null;
       }
     }
     while (display !== getState().labelDisplay);
 
     removeFromCache();
     dispatch({ type: actions.FETCH_DOMINATOR_TREE_END, id, root });
-    telemetry.countDominatorTree({ display });
     return root;
   }
 });
 
 /**
  * Fetch the immediately dominated children represented by the placeholder
  * `lazyChildren` from snapshot-with-the-given-id's dominator tree.
  *
--- a/devtools/client/memory/moz.build
+++ b/devtools/client/memory/moz.build
@@ -15,15 +15,14 @@ DIRS += [
 DevToolsModules(
     'app.js',
     'constants.js',
     'dominator-tree-lazy-children.js',
     'models.js',
     'panel.js',
     'reducers.js',
     'store.js',
-    'telemetry.js',
     'utils.js',
 )
 
 BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
 XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
 MOCHITEST_CHROME_MANIFESTS += ['test/chrome/chrome.ini']
deleted file mode 100644
--- a/devtools/client/memory/telemetry.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-// This module exports methods to record telemetry data for memory tool usage.
-//
-// NB: Ensure that *every* exported function is wrapped in `makeInfallible` so
-// that our probes don't accidentally break code that actually does productive
-// work for the user!
-
-const { telemetry } = require("Services");
-const { makeInfallible, immutableUpdate } = require("devtools/shared/DevToolsUtils");
-const { labelDisplays, censusDisplays } = require("./constants");
-
-exports.countTakeSnapshot = makeInfallible(function () {
-  const histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_TAKE_SNAPSHOT_COUNT");
-  histogram.add(1);
-}, "devtools/client/memory/telemetry#countTakeSnapshot");
-
-exports.countImportSnapshot = makeInfallible(function () {
-  const histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_IMPORT_SNAPSHOT_COUNT");
-  histogram.add(1);
-}, "devtools/client/memory/telemetry#countImportSnapshot");
-
-exports.countExportSnapshot = makeInfallible(function () {
-  const histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_EXPORT_SNAPSHOT_COUNT");
-  histogram.add(1);
-}, "devtools/client/memory/telemetry#countExportSnapshot");
-
-const COARSE_TYPE = "Coarse Type";
-const ALLOCATION_STACK = "Allocation Stack";
-const INVERTED_ALLOCATION_STACK = "Inverted Allocation Stack";
-const CUSTOM = "Custom";
-
-/**
- * @param {String|null} filter
- *        The filter string used, if any.
- *
- * @param {Boolean} diffing
- *        True if the census was a diffing census, false otherwise.
- *
- * @param {censusDisplayModel} display
- *        The display used with the census.
- */
-exports.countCensus = makeInfallible(function ({ filter, diffing, display }) {
-  let histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_INVERTED_CENSUS");
-  histogram.add(!!display.inverted);
-
-  histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_FILTER_CENSUS");
-  histogram.add(!!filter);
-
-  histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_DIFF_CENSUS");
-  histogram.add(!!diffing);
-
-  histogram = telemetry.getKeyedHistogramById("DEVTOOLS_MEMORY_BREAKDOWN_CENSUS_COUNT");
-  if (display === censusDisplays.coarseType) {
-    histogram.add(COARSE_TYPE);
-  } else if (display === censusDisplays.allocationStack) {
-    histogram.add(ALLOCATION_STACK);
-  } else if (display === censusDisplays.invertedAllocationStack) {
-    histogram.add(INVERTED_ALLOCATION_STACK);
-  } else {
-    histogram.add(CUSTOM);
-  }
-}, "devtools/client/memory/telemetry#countCensus");
-
-/**
- * @param {Object} opts
- *        The same parameters specified for countCensus.
- */
-exports.countDiff = makeInfallible(function (opts) {
-  exports.countCensus(immutableUpdate(opts, { diffing: true }));
-}, "devtools/client/memory/telemetry#countDiff");
-
-/**
- * @param {Object} display
- *        The display used to label nodes in the dominator tree.
- */
-exports.countDominatorTree = makeInfallible(function ({ display }) {
-  let histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_DOMINATOR_TREE_COUNT");
-  histogram.add(1);
-
-  histogram =
-    telemetry.getKeyedHistogramById("DEVTOOLS_MEMORY_BREAKDOWN_DOMINATOR_TREE_COUNT");
-  if (display === labelDisplays.coarseType) {
-    histogram.add(COARSE_TYPE);
-  } else if (display === labelDisplays.allocationStack) {
-    histogram.add(ALLOCATION_STACK);
-  } else {
-    histogram.add(CUSTOM);
-  }
-}, "devtools/client/memory/telemetry#countDominatorTree");