Bug 1381704 - Remove unused Application Reputation telemetry probe. r=hchang,liuche
authorFrancois Marier <francois@mozilla.com>
Tue, 22 Aug 2017 17:16:24 -0700
changeset 376419 ee32fa61c1ba988719d5c1ad2de9890c0d8858c8
parent 376418 c1505d31ad0ff45a74994616fc9cfdb362e8987f
child 376420 bb814f1d5ae08a08eb89bbbb786f24c1a22a3825
push id49462
push userfmarier@mozilla.com
push dateWed, 23 Aug 2017 21:32:58 +0000
treeherderautoland@ee32fa61c1ba [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershchang, liuche
bugs1381704
milestone57.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 1381704 - Remove unused Application Reputation telemetry probe. r=hchang,liuche MozReview-Commit-ID: GLjgu8VP1z8
toolkit/components/downloads/ApplicationReputation.cpp
toolkit/components/downloads/test/unit/test_app_rep.js
toolkit/components/telemetry/Histograms.json
toolkit/components/telemetry/histogram-whitelists.json
--- a/toolkit/components/downloads/ApplicationReputation.cpp
+++ b/toolkit/components/downloads/ApplicationReputation.cpp
@@ -1578,17 +1578,16 @@ ApplicationReputationService::~Applicati
 NS_IMETHODIMP
 ApplicationReputationService::QueryReputation(
     nsIApplicationReputationQuery* aQuery,
     nsIApplicationReputationCallback* aCallback) {
   LOG(("Starting application reputation check [query=%p]", aQuery));
   NS_ENSURE_ARG_POINTER(aQuery);
   NS_ENSURE_ARG_POINTER(aCallback);
 
-  Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_COUNT, true);
   nsresult rv = QueryReputationInternal(aQuery, aCallback);
   if (NS_FAILED(rv)) {
     Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_SHOULD_BLOCK,
       false);
     aCallback->OnComplete(false, rv,
                           nsIApplicationReputationService::VERDICT_SAFE);
   }
   return NS_OK;
--- a/toolkit/components/downloads/test/unit/test_app_rep.js
+++ b/toolkit/components/downloads/test/unit/test_app_rep.js
@@ -94,24 +94,18 @@ add_task(async function test_setup() {
     return (async function() {
       await new Promise(resolve => {
         gHttpServ.stop(resolve);
       });
     })();
   });
 });
 
-function check_telemetry(aCount,
-                         aShouldBlockCount,
+function check_telemetry(aShouldBlockCount,
                          aListCounts) {
-  let count = Cc["@mozilla.org/base/telemetry;1"]
-                .getService(Ci.nsITelemetry)
-                .getHistogramById("APPLICATION_REPUTATION_COUNT")
-                .snapshot();
-  do_check_eq(count.counts[1], aCount);
   let local = Cc["@mozilla.org/base/telemetry;1"]
                 .getService(Ci.nsITelemetry)
                 .getHistogramById("APPLICATION_REPUTATION_LOCAL")
                 .snapshot();
   do_check_eq(local.counts[ALLOW_LIST], aListCounts[ALLOW_LIST],
               "Allow list counts don't match");
   do_check_eq(local.counts[BLOCK_LIST], aListCounts[BLOCK_LIST],
               "Block list counts don't match");
@@ -119,64 +113,57 @@ function check_telemetry(aCount,
               "No list counts don't match");
 
   let shouldBlock = Cc["@mozilla.org/base/telemetry;1"]
                 .getService(Ci.nsITelemetry)
                 .getHistogramById("APPLICATION_REPUTATION_SHOULD_BLOCK")
                 .snapshot();
   // SHOULD_BLOCK = true
   do_check_eq(shouldBlock.counts[1], aShouldBlockCount);
-  // Sanity check that SHOULD_BLOCK total adds up to the COUNT.
-  do_check_eq(shouldBlock.counts[0] + shouldBlock.counts[1], aCount);
 }
 
 function get_telemetry_counts() {
-  let count = Cc["@mozilla.org/base/telemetry;1"]
-                .getService(Ci.nsITelemetry)
-                .getHistogramById("APPLICATION_REPUTATION_COUNT")
-                .snapshot();
   let local = Cc["@mozilla.org/base/telemetry;1"]
                 .getService(Ci.nsITelemetry)
                 .getHistogramById("APPLICATION_REPUTATION_LOCAL")
                 .snapshot();
   let shouldBlock = Cc["@mozilla.org/base/telemetry;1"]
                 .getService(Ci.nsITelemetry)
                 .getHistogramById("APPLICATION_REPUTATION_SHOULD_BLOCK")
                 .snapshot();
-  return { total: count.counts[1],
-           shouldBlock: shouldBlock.counts[1],
+  return { shouldBlock: shouldBlock.counts[1],
            listCounts: local.counts };
 }
 
 add_test(function test_nullSourceURI() {
   let counts = get_telemetry_counts();
   gAppRep.queryReputation({
     // No source URI
     fileSize: 12,
   }, function onComplete(aShouldBlock, aStatus) {
     do_check_eq(Cr.NS_ERROR_UNEXPECTED, aStatus);
     do_check_false(aShouldBlock);
-    check_telemetry(counts.total + 1, counts.shouldBlock, counts.listCounts);
+    check_telemetry(counts.shouldBlock, counts.listCounts);
     run_next_test();
   });
 });
 
 add_test(function test_nullCallback() {
   let counts = get_telemetry_counts();
   try {
     gAppRep.queryReputation({
       sourceURI: createURI("http://example.com"),
       fileSize: 12,
     }, null);
     do_throw("Callback cannot be null");
   } catch (ex) {
     if (ex.result != Cr.NS_ERROR_INVALID_POINTER)
       throw ex;
     // We don't even increment the count here, because there's no callback.
-    check_telemetry(counts.total, counts.shouldBlock, counts.listCounts);
+    check_telemetry(counts.shouldBlock, counts.listCounts);
     run_next_test();
   }
 });
 
 // Set up the local whitelist.
 add_test(function test_local_list() {
   // Construct a response with redirect urls.
   function processUpdateRequest() {
@@ -234,17 +221,17 @@ add_test(function test_unlisted() {
   let listCounts = counts.listCounts;
   listCounts[NO_LIST]++;
   gAppRep.queryReputation({
     sourceURI: exampleURI,
     fileSize: 12,
   }, function onComplete(aShouldBlock, aStatus) {
     do_check_eq(Cr.NS_OK, aStatus);
     do_check_false(aShouldBlock);
-    check_telemetry(counts.total + 1, counts.shouldBlock, listCounts);
+    check_telemetry(counts.shouldBlock, listCounts);
     run_next_test();
   });
 });
 
 add_test(function test_non_uri() {
   Services.prefs.setCharPref(appRepURLPref,
                              "http://localhost:4444/download");
   let counts = get_telemetry_counts();
@@ -253,34 +240,34 @@ add_test(function test_non_uri() {
   let source = NetUtil.newURI("data:application/octet-stream,ABC");
   do_check_false(source instanceof Ci.nsIURL);
   gAppRep.queryReputation({
     sourceURI: source,
     fileSize: 12,
   }, function onComplete(aShouldBlock, aStatus) {
     do_check_eq(Cr.NS_OK, aStatus);
     do_check_false(aShouldBlock);
-    check_telemetry(counts.total + 1, counts.shouldBlock, listCounts);
+    check_telemetry(counts.shouldBlock, listCounts);
     run_next_test();
   });
 });
 
 add_test(function test_local_blacklist() {
   Services.prefs.setCharPref(appRepURLPref,
                              "http://localhost:4444/download");
   let counts = get_telemetry_counts();
   let listCounts = counts.listCounts;
   listCounts[BLOCK_LIST]++;
   gAppRep.queryReputation({
     sourceURI: blocklistedURI,
     fileSize: 12,
   }, function onComplete(aShouldBlock, aStatus) {
     do_check_eq(Cr.NS_OK, aStatus);
     do_check_true(aShouldBlock);
-    check_telemetry(counts.total + 1, counts.shouldBlock + 1, listCounts);
+    check_telemetry(counts.shouldBlock + 1, listCounts);
     run_next_test();
   });
 });
 
 add_test(function test_referer_blacklist() {
   Services.prefs.setCharPref(appRepURLPref,
                              "http://localhost:4444/download");
   let counts = get_telemetry_counts();
@@ -288,17 +275,17 @@ add_test(function test_referer_blacklist
   listCounts[BLOCK_LIST]++;
   gAppRep.queryReputation({
     sourceURI: exampleURI,
     referrerURI: blocklistedURI,
     fileSize: 12,
   }, function onComplete(aShouldBlock, aStatus) {
     do_check_eq(Cr.NS_OK, aStatus);
     do_check_true(aShouldBlock);
-    check_telemetry(counts.total + 1, counts.shouldBlock + 1, listCounts);
+    check_telemetry(counts.shouldBlock + 1, listCounts);
     run_next_test();
   });
 });
 
 add_test(function test_blocklist_trumps_allowlist() {
   Services.prefs.setCharPref(appRepURLPref,
                              "http://localhost:4444/download");
   let counts = get_telemetry_counts();
@@ -306,17 +293,17 @@ add_test(function test_blocklist_trumps_
   listCounts[BLOCK_LIST]++;
   gAppRep.queryReputation({
     sourceURI: whitelistedURI,
     referrerURI: blocklistedURI,
     fileSize: 12,
   }, function onComplete(aShouldBlock, aStatus) {
     do_check_eq(Cr.NS_OK, aStatus);
     do_check_true(aShouldBlock);
-    check_telemetry(counts.total + 1, counts.shouldBlock + 1, listCounts);
+    check_telemetry(counts.shouldBlock + 1, listCounts);
     run_next_test();
   });
 });
 
 add_test(function test_redirect_on_blocklist() {
   Services.prefs.setCharPref(appRepURLPref,
                              "http://localhost:4444/download");
   let counts = get_telemetry_counts();
@@ -348,12 +335,12 @@ add_test(function test_redirect_on_block
   gAppRep.queryReputation({
     sourceURI: whitelistedURI,
     referrerURI: exampleURI,
     redirects: badRedirects,
     fileSize: 12,
   }, function onComplete(aShouldBlock, aStatus) {
     do_check_eq(Cr.NS_OK, aStatus);
     do_check_true(aShouldBlock);
-    check_telemetry(counts.total + 1, counts.shouldBlock + 1, listCounts);
+    check_telemetry(counts.shouldBlock + 1, listCounts);
     run_next_test();
   });
 });
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -120,23 +120,16 @@
     "alert_emails": ["francois@mozilla.com", "safebrowsing-telemetry@mozilla.org"],
     "expires_in_version": "never",
     "releaseChannelCollection": "opt-out",
     "bug_numbers": [1272788],
     "kind": "enumerated",
     "n_values": 8,
     "description": "Application reputation remote verdict (0=SAFE, 1=DANGEROUS, 2=UNCOMMON, 3=POTENTIALLY_UNWANTED, 4=DANGEROUS_HOST, 5=UNKNOWN)"
   },
-  "APPLICATION_REPUTATION_COUNT": {
-    "record_in_processes": ["main", "content"],
-    "alert_emails": ["safebrowsing-telemetry@mozilla.org"],
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Application reputation query count (both local and remote)"
-  },
   "APPLICATION_REPUTATION_REMOTE_LOOKUP_TIMEOUT": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["francois@mozilla.com", "safebrowsing-telemetry@mozilla.org"],
     "expires_in_version": "never",
     "releaseChannelCollection": "opt-out",
     "kind": "boolean",
     "bug_numbers": [1172689],
     "description": "Recorded when application reputation remote lookup is performed, `true` is recorded if the lookup times out."
--- a/toolkit/components/telemetry/histogram-whitelists.json
+++ b/toolkit/components/telemetry/histogram-whitelists.json
@@ -588,17 +588,16 @@
     "WEBSOCKETS_HANDSHAKE_TYPE",
     "XMLHTTPREQUEST_ASYNC_OR_SYNC",
     "XUL_CACHE_DISABLED"
   ],
   "bug_numbers": [
     "A11Y_IATABLE_USAGE_FLAG",
     "A11Y_ISIMPLEDOM_USAGE_FLAG",
     "ADDON_SHIM_USAGE",
-    "APPLICATION_REPUTATION_COUNT",
     "APPLICATION_REPUTATION_LOCAL",
     "APPLICATION_REPUTATION_SERVER",
     "APPLICATION_REPUTATION_SHOULD_BLOCK",
     "AUDIOSTREAM_FIRST_OPEN_MS",
     "AUDIOSTREAM_LATER_OPEN_MS",
     "AUTO_REJECTED_TRANSLATION_OFFERS",
     "BACKGROUNDFILESAVER_THREAD_COUNT",
     "BAD_FALLBACK_FONT",