Bug 1296723 - Remove logOncePerBrowserVersion telemetry functions and probes r?jryans draft
authorMichael Ratcliffe <mratcliffe@mozilla.com>
Wed, 09 May 2018 12:01:35 +0100
changeset 797653 a616210114feb43ec69b16b1c41b13f59486271b
parent 797652 0259717153203bb50f021e80983c6602adbb9b92
child 797654 c53ed3829c50e431ee7fe6d452fffb5d5b6bad70
push id110526
push userbmo:mratcliffe@mozilla.com
push dateMon, 21 May 2018 09:11:21 +0000
reviewersjryans
bugs1296723
milestone62.0a1
Bug 1296723 - Remove logOncePerBrowserVersion telemetry functions and probes r?jryans MozReview-Commit-ID: AvUuzTgoEhz
devtools/client/framework/toolbox.js
devtools/client/preferences/devtools-client.js
devtools/client/shared/telemetry.js
devtools/client/shared/test/browser_telemetry_misc.js
devtools/client/shared/test/telemetry-test-helpers.js
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/histogram-whitelists.json
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -6,17 +6,16 @@
 
 const SOURCE_MAP_WORKER = "resource://devtools/client/shared/source-map/worker.js";
 
 const MAX_ORDINAL = 99;
 const SPLITCONSOLE_ENABLED_PREF = "devtools.toolbox.splitconsoleEnabled";
 const SPLITCONSOLE_HEIGHT_PREF = "devtools.toolbox.splitconsoleHeight";
 const DISABLE_AUTOHIDE_PREF = "ui.popup.disable_autohide";
 const HOST_HISTOGRAM = "DEVTOOLS_TOOLBOX_HOST";
-const SCREENSIZE_HISTOGRAM = "DEVTOOLS_SCREEN_RESOLUTION_ENUMERATED_PER_USER";
 const CURRENT_THEME_SCALAR = "devtools.current_theme";
 const HTML_NS = "http://www.w3.org/1999/xhtml";
 const REGEX_PANEL = /webconsole|inspector|jsdebugger|styleeditor|netmonitor|storage/;
 
 var {Ci, Cc} = require("chrome");
 var promise = require("promise");
 var defer = require("devtools/shared/defer");
 var Services = require("Services");
@@ -46,18 +45,16 @@ loader.lazyRequireGetter(this, "Selectio
 loader.lazyRequireGetter(this, "InspectorFront",
   "devtools/shared/fronts/inspector", true);
 loader.lazyRequireGetter(this, "flags",
   "devtools/shared/flags");
 loader.lazyRequireGetter(this, "showDoorhanger",
   "devtools/client/shared/doorhanger", true);
 loader.lazyRequireGetter(this, "createPerformanceFront",
   "devtools/shared/fronts/performance", true);
-loader.lazyRequireGetter(this, "system",
-  "devtools/shared/system");
 loader.lazyRequireGetter(this, "getPreferenceFront",
   "devtools/shared/fronts/preference", true);
 loader.lazyRequireGetter(this, "KeyShortcuts",
   "devtools/client/shared/key-shortcuts");
 loader.lazyRequireGetter(this, "ZoomKeys",
   "devtools/client/shared/zoom-keys");
 loader.lazyRequireGetter(this, "settleAll",
   "devtools/shared/ThreadSafeDevToolsUtils", true);
@@ -713,18 +710,16 @@ Toolbox.prototype = {
       case Toolbox.HostType.CUSTOM: return "other";
       default: return "bottom";
     }
   },
 
   _pingTelemetry: function() {
     this.telemetry.toolOpened("toolbox");
 
-    this.telemetry.logOncePerBrowserVersion(SCREENSIZE_HISTOGRAM,
-                                             system.getScreenDimensions());
     this.telemetry.getHistogramById(HOST_HISTOGRAM).add(this._getTelemetryHostId());
 
     // Log current theme. The question we want to answer is:
     // "What proportion of users use which themes?"
     let currentTheme = Services.prefs.getCharPref("devtools.theme");
     this.telemetry.keyedScalarAdd(CURRENT_THEME_SCALAR, currentTheme, 1);
 
     this.telemetry.preparePendingEvent(
--- a/devtools/client/preferences/devtools-client.js
+++ b/devtools/client/preferences/devtools-client.js
@@ -312,19 +312,14 @@ pref("devtools.hud.loglimit", 10000);
 pref("devtools.editor.tabsize", 2);
 pref("devtools.editor.expandtab", true);
 pref("devtools.editor.keymap", "default");
 pref("devtools.editor.autoclosebrackets", true);
 pref("devtools.editor.detectindentation", true);
 pref("devtools.editor.enableCodeFolding", true);
 pref("devtools.editor.autocomplete", true);
 
-// Pref to store the browser version at the time of a telemetry ping for an
-// opened developer tool. This allows us to ping telemetry just once per browser
-// version for each user.
-pref("devtools.telemetry.tools.opened.version", "{}");
-
 // Whether to reload when touch simulation is toggled
 pref("devtools.responsive.reloadConditions.touchSimulation", false);
 // Whether to reload when user agent is changed
 pref("devtools.responsive.reloadConditions.userAgent", false);
 // Whether to show the notification about reloading to apply emulation
 pref("devtools.responsive.reloadNotification.enabled", true);
--- a/devtools/client/shared/telemetry.js
+++ b/devtools/client/shared/telemetry.js
@@ -8,31 +8,29 @@
  * Comprehensive documentation is in docs/frontend/telemetry.md
  */
 
 "use strict";
 
 const Services = require("Services");
 const { TelemetryStopwatch } = require("resource://gre/modules/TelemetryStopwatch.jsm");
 const { getNthPathExcluding } = require("devtools/shared/platform/stack");
-const TOOLS_OPENED_PREF = "devtools.telemetry.tools.opened.version";
 
 // Object to be shared among all instances.
 const PENDING_EVENTS = new Map();
 const PENDING_EVENT_PROPERTIES = new Map();
 
 class Telemetry {
   constructor() {
     // Bind pretty much all functions so that callers do not need to.
     this.getHistogramById = this.getHistogramById.bind(this);
     this.getKeyedHistogramById = this.getKeyedHistogramById.bind(this);
     this.scalarSet = this.scalarSet.bind(this);
     this.scalarAdd = this.scalarAdd.bind(this);
     this.keyedScalarAdd = this.keyedScalarAdd.bind(this);
-    this.logOncePerBrowserVersion = this.logOncePerBrowserVersion.bind(this);
     this.recordEvent = this.recordEvent.bind(this);
     this.setEventRecordingEnabled = this.setEventRecordingEnabled.bind(this);
     this.preparePendingEvent = this.preparePendingEvent.bind(this);
     this.addEventProperty = this.addEventProperty.bind(this);
     this.toolOpened = this.toolOpened.bind(this);
     this.toolClosed = this.toolClosed.bind(this);
   }
 
@@ -267,39 +265,16 @@ class Telemetry {
     } catch (e) {
       dump(`Warning: An attempt was made to write to the ${scalarId} ` +
            `scalar, which is not defined in Scalars.yaml\n` +
            `CALLER: ${getCaller()}`);
     }
   }
 
   /**
-   * Log info about usage once per browser version. This allows us to discover
-   * how many individual users are using our tools for each browser version.
-   *
-   * @param  {String} perUserHistogram
-   *         Histogram in which the data is to be stored.
-   */
-  logOncePerBrowserVersion(perUserHistogram, value) {
-    let currentVersion = Services.appinfo.version;
-    let latest = Services.prefs.getCharPref(TOOLS_OPENED_PREF);
-    let latestObj = JSON.parse(latest);
-
-    let lastVersionHistogramUpdated = latestObj[perUserHistogram];
-
-    if (typeof lastVersionHistogramUpdated == "undefined" ||
-        lastVersionHistogramUpdated !== currentVersion) {
-      latestObj[perUserHistogram] = currentVersion;
-      latest = JSON.stringify(latestObj);
-      Services.prefs.setCharPref(TOOLS_OPENED_PREF, latest);
-      this.getHistogramById(perUserHistogram).add(value);
-    }
-  }
-
-  /**
    * Event telemetry is disabled by default. Use this method to enable it for
    * a particular category.
    *
    * @param {String} category
    *        The telemetry event category e.g. "devtools.main"
    * @param {Boolean} enabled
    *        Enabled: true or false.
    */
--- a/devtools/client/shared/test/browser_telemetry_misc.js
+++ b/devtools/client/shared/test/browser_telemetry_misc.js
@@ -21,12 +21,10 @@ function checkResults() {
   // For help generating these tests use generateTelemetryTests("DEVTOOLS_")
   // here.
   checkTelemetry("DEVTOOLS_TOOLBOX_OPENED_COUNT", "", [1, 0, 0], "array");
   checkTelemetry("DEVTOOLS_INSPECTOR_OPENED_COUNT", "", [1, 0, 0], "array");
   checkTelemetry("DEVTOOLS_RULEVIEW_OPENED_COUNT", "", [1, 0, 0], "array");
   checkTelemetry("DEVTOOLS_TOOLBOX_TIME_ACTIVE_SECONDS", "", null, "hasentries");
   checkTelemetry("DEVTOOLS_INSPECTOR_TIME_ACTIVE_SECONDS", "", null, "hasentries");
   checkTelemetry("DEVTOOLS_RULEVIEW_TIME_ACTIVE_SECONDS", "", null, "hasentries");
-  checkTelemetry(
-    "DEVTOOLS_SCREEN_RESOLUTION_ENUMERATED_PER_USER", "", null, "hasentries");
   checkTelemetry("DEVTOOLS_TOOLBOX_HOST", "", null, "hasentries");
 }
--- a/devtools/client/shared/test/telemetry-test-helpers.js
+++ b/devtools/client/shared/test/telemetry-test-helpers.js
@@ -22,17 +22,16 @@ class TelemetryHelpers {
   startTelemetry() {
     Services.telemetry.canRecordExtended = true;
   }
 
   /**
    * Clear all telemetry types.
    */
   stopTelemetry() {
-    this.clearToolsOpenedPref();
     Services.telemetry.canRecordExtended = this.oldCanRecord;
 
     // Clear histograms, scalars and Telemetry Events.
     this.clearHistograms(Services.telemetry.snapshotHistograms);
     this.clearHistograms(Services.telemetry.snapshotKeyedHistograms);
     Services.telemetry.clearScalars();
     Services.telemetry.clearEvents();
   }
@@ -69,25 +68,16 @@ class TelemetryHelpers {
             // swallow the "histogram does not exist" error silently here.
           }
         }
       }
     }
   }
 
   /**
-   * Clears the pref that is used to log telemetry data once per browser version.
-   */
-  clearToolsOpenedPref() {
-    const TOOLS_OPENED_PREF = "devtools.telemetry.tools.opened.version";
-
-    Services.prefs.clearUserPref(TOOLS_OPENED_PREF);
-  }
-
-  /**
    * Check the value of a given telemetry histogram.
    *
    * @param  {String} histId
    *         Histogram id
    * @param  {String} key
    *         Keyed histogram key
    * @param  {Array|Number} expected
    *         Expected value
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -10004,23 +10004,16 @@
     "expires_in_version": "never",
     "kind": "boolean",
     "keyed": true,
     "bug_numbers": [1159043, 1448074],
     "alert_emails": ["dev-developer-tools@lists.mozilla.org", "jryans@mozilla.com"],
     "releaseChannelCollection": "opt-out",
     "description": "What runtime version did WebIDE connect to?"
   },
-  "DEVTOOLS_SCREEN_RESOLUTION_ENUMERATED_PER_USER": {
-    "record_in_processes": ["main", "content"],
-    "expires_in_version": "never",
-    "kind": "enumerated",
-    "n_values": 13,
-    "description": "Screen resolution of DevTools user (0:lower, 1:800x600, 2:1024x768, 3:1280x800, 4:1280x1024, 5:1366x768, 6:1440x900, 7:1920x1080, 8:2560×1440, 9:2560×1600, 10:2880x1800, 11:other, 12:higher)"
-  },
   "DEVTOOLS_SAVE_HEAP_SNAPSHOT_MS": {
     "record_in_processes": ["main", "content"],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 100000,
     "n_buckets": 1000,
     "description": "The time (in milliseconds) that it took to save a heap snapshot in mozilla::devtools::ChromeUtils::SaveHeapSnapshot."
   },
--- a/toolkit/components/telemetry/histogram-whitelists.json
+++ b/toolkit/components/telemetry/histogram-whitelists.json
@@ -123,17 +123,16 @@
     "DEVTOOLS_PERFTOOLS_RECORDING_COUNT",
     "DEVTOOLS_PERFTOOLS_RECORDING_DURATION_MS",
     "DEVTOOLS_PERFTOOLS_RECORDING_EXPORT_FLAG",
     "DEVTOOLS_PERFTOOLS_RECORDING_FEATURES_USED",
     "DEVTOOLS_PERFTOOLS_RECORDING_IMPORT_FLAG",
     "DEVTOOLS_PERFTOOLS_SELECTED_VIEW_MS",
     "DEVTOOLS_READ_HEAP_SNAPSHOT_MS",
     "DEVTOOLS_SAVE_HEAP_SNAPSHOT_MS",
-    "DEVTOOLS_SCREEN_RESOLUTION_ENUMERATED_PER_USER",
     "DEVTOOLS_WEBIDE_CONNECTION_DEBUG_USED",
     "DEVTOOLS_WEBIDE_CONNECTION_PLAY_USED",
     "DEVTOOLS_WEBIDE_CONNECTION_TIME_SECONDS",
     "DNS_CLEANUP_AGE",
     "DNS_RENEWAL_TIME",
     "DNS_RENEWAL_TIME_FOR_TTL",
     "DNT_USAGE",
     "DWRITEFONT_DELAYEDINITFONTLIST_COLLECT",
@@ -639,17 +638,16 @@
     "DEVTOOLS_PERFTOOLS_RECORDING_COUNT",
     "DEVTOOLS_PERFTOOLS_RECORDING_DURATION_MS",
     "DEVTOOLS_PERFTOOLS_RECORDING_EXPORT_FLAG",
     "DEVTOOLS_PERFTOOLS_RECORDING_FEATURES_USED",
     "DEVTOOLS_PERFTOOLS_RECORDING_IMPORT_FLAG",
     "DEVTOOLS_PERFTOOLS_SELECTED_VIEW_MS",
     "DEVTOOLS_READ_HEAP_SNAPSHOT_MS",
     "DEVTOOLS_SAVE_HEAP_SNAPSHOT_MS",
-    "DEVTOOLS_SCREEN_RESOLUTION_ENUMERATED_PER_USER",
     "DEVTOOLS_WEBIDE_CONNECTION_DEBUG_USED",
     "DEVTOOLS_WEBIDE_CONNECTION_PLAY_USED",
     "DEVTOOLS_WEBIDE_CONNECTION_TIME_SECONDS",
     "DNS_BLACKLIST_COUNT",
     "DNS_CLEANUP_AGE",
     "DNS_FAILED_LOOKUP_TIME",
     "DNS_LOOKUP_METHOD2",
     "DNS_LOOKUP_TIME",