Bug 1124392 - Telemetry: Record the number of passwords per hostname. r=MattN
authorChenxia Liu <liuche@mozilla.com>
Mon, 02 Feb 2015 12:51:48 -0800
changeset 227321 9c18e56a7b50990d651257c3d8462ddfa2a65266
parent 227320 a9cc1659d77fb659ed0cf7bcfad94a8951b9c587
child 227322 4171b3354b53ec1869417dd8714d7065b05db07b
push id28227
push usercbook@mozilla.com
push dateWed, 04 Feb 2015 13:03:03 +0000
treeherdermozilla-central@121149b9443a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1124392
milestone38.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 1124392 - Telemetry: Record the number of passwords per hostname. r=MattN
toolkit/components/passwordmgr/nsLoginManager.js
toolkit/components/telemetry/Histograms.json
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -248,27 +248,36 @@ LoginManager.prototype = {
       return;
     }
 
     let logins = this.getAllLogins({});
 
     let usernamePresentHistogram = clearAndGetHistogram("PWMGR_USERNAME_PRESENT");
     let loginLastUsedDaysHistogram = clearAndGetHistogram("PWMGR_LOGIN_LAST_USED_DAYS");
 
+    let hostnameCount = new Map();
     for (let login of logins) {
       usernamePresentHistogram.add(!!login.username);
 
+      let hostname = login.hostname;
+      hostnameCount.set(hostname, (hostnameCount.get(hostname) || 0 ) + 1);
+
       login.QueryInterface(Ci.nsILoginMetaInfo);
       let timeLastUsedAgeMs = referenceTimeMs - login.timeLastUsed;
       if (timeLastUsedAgeMs > 0) {
         loginLastUsedDaysHistogram.add(
           Math.floor(timeLastUsedAgeMs / MS_PER_DAY)
         );
       }
     }
+
+    let passwordsCountHistogram = clearAndGetHistogram("PWMGR_NUM_PASSWORDS_PER_HOSTNAME");
+    for (let count of hostnameCount.values()) {
+      passwordsCountHistogram.add(count);
+    }
   },
 
 
 
 
 
   /* ---------- Primary Public interfaces ---------- */
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7283,16 +7283,23 @@
   "PWMGR_BLOCKLIST_NUM_SITES": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 100,
     "n_buckets" : 10,
     "extended_statistics_ok": true,
     "description": "The number of sites for which the user has explicitly rejected saving logins"
   },
+  "PWMGR_NUM_PASSWORDS_PER_HOSTNAME": {
+    "expires_in_version": "never",
+    "kind": "linear",
+    "high": 21,
+    "n_buckets" : 20,
+    "description": "The number of passwords per hostname"
+  },
   "PWMGR_NUM_SAVED_PASSWORDS": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 750,
     "n_buckets" : 50,
     "extended_statistics_ok": true,
     "description": "Total number of saved logins, including those that cannot be decrypted"
   },