Bug 1285515 - Telemetry wanted: How many of each container type is open for usercontext id 1-4, r=francois
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 21 Jul 2016 09:21:15 +0200
changeset 306039 40a41381cbd4a49d311348b5287bbc6e6ffa9c3e
parent 306038 ba6b75f296522d9e351d1201ed8c981824c61da8
child 306040 6e99af8e9fa468fb6d99e315a6dabc7c72822ad9
push id30474
push usercbook@mozilla.com
push dateThu, 21 Jul 2016 14:25:10 +0000
treeherdermozilla-central@6b180266ac16 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrancois
bugs1285515
milestone50.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 1285515 - Telemetry wanted: How many of each container type is open for usercontext id 1-4, r=francois
toolkit/components/contextualidentity/ContextualIdentityService.jsm
toolkit/components/telemetry/Histograms.json
--- a/toolkit/components/contextualidentity/ContextualIdentityService.jsm
+++ b/toolkit/components/contextualidentity/ContextualIdentityService.jsm
@@ -18,38 +18,46 @@ XPCOMUtils.defineLazyGetter(this, "gBrow
 this.ContextualIdentityService = {
   _identities: [
     { userContextId: 1,
       public: true,
       icon: "chrome://browser/skin/usercontext/personal.svg",
       color: "#00a7e0",
       label: "userContextPersonal.label",
       accessKey: "userContextPersonal.accesskey",
-      alreadyOpened: false },
+      alreadyOpened: false,
+      telemetryId: 1,
+    },
     { userContextId: 2,
       public: true,
       icon: "chrome://browser/skin/usercontext/work.svg",
       color: "#f89c24",
       label: "userContextWork.label",
       accessKey: "userContextWork.accesskey",
-      alreadyOpened: false },
+      alreadyOpened: false,
+      telemetryId: 2,
+    },
     { userContextId: 3,
       public: true,
       icon: "chrome://browser/skin/usercontext/banking.svg",
       color: "#7dc14c",
       label: "userContextBanking.label",
       accessKey: "userContextBanking.accesskey",
-      alreadyOpened: false },
+      alreadyOpened: false,
+      telemetryId: 3,
+    },
     { userContextId: 4,
       public: true,
       icon: "chrome://browser/skin/usercontext/shopping.svg",
       color: "#ee5195",
       label: "userContextShopping.label",
       accessKey: "userContextShopping.accesskey",
-      alreadyOpened: false },
+      alreadyOpened: false,
+      telemetryId: 4,
+    },
     { userContextId: Math.pow(2, 31) - 1,
       public: false,
       icon: "",
       color: "",
       label: "userContextIdInternal.thumbnail",
       accessKey: "",
       alreadyOpened: false },
   ],
@@ -92,20 +100,25 @@ this.ContextualIdentityService = {
     tab.style.backgroundSize = "auto 2px";
     tab.style.backgroundRepeat = "no-repeat";
   },
 
   telemetry(userContextId) {
     let identity = this.getIdentityFromId(userContextId);
 
     // Let's ignore unknown identities for now.
-    if (!identity) {
+    if (!identity || !identity.public) {
       return;
     }
 
     if (!identity.alreadyOpened) {
       identity.alreadyOpened = true;
       Services.telemetry.getHistogramById("UNIQUE_CONTAINERS_OPENED").add(1);
     }
 
     Services.telemetry.getHistogramById("TOTAL_CONTAINERS_OPENED").add(1);
+
+    if (identity.telemetryId) {
+      Services.telemetry.getHistogramById("CONTAINER_USED")
+                        .add(identity.telemetryId);
+    }
   },
 }
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -9978,16 +9978,24 @@
   "WEBKIT_DIRECTORY_USED": {
     "alert_emails": ["amarchesini@mozilla.com"],
     "expires_in_version": "never",
     "kind": "boolean",
     "bug_numbers": [1272501],
     "releaseChannelCollection": "opt-out",
     "description": "HTMLInputElement.webkitdirectory attribute used"
   },
+  "CONTAINER_USED": {
+    "alert_emails": ["amarchesini@mozilla.com"],
+    "expires_in_version": "55",
+    "kind": "enumerated",
+    "bug_numbers": [1276006],
+    "n_values": 5,
+    "description": "Records a value each time a builtin container is opened. 1=personal 2=work 3=banking 4=shopping. Does not record usage of user-created containers."
+  },
   "UNIQUE_CONTAINERS_OPENED": {
     "alert_emails": ["amarchesini@mozilla.com"],
     "expires_in_version": "never",
     "bug_numbers": [1276006],
     "kind": "count",
     "description": "Tracking the unique number of opened Containers."
   },
   "TOTAL_CONTAINERS_OPENED": {