Bug 1357207 - Caching duration recorded to telemetry should be milli-second . r?francois draft
authorDimiL <dlee@mozilla.com>
Tue, 18 Apr 2017 12:01:09 +0800
changeset 564046 f83e8f51f43c127c542b0ec700fb2fc61d364f04
parent 563802 a374c35469935a874fefe64d3e07003fc5bc8884
child 624654 dbc00d77aa9d94ea4a968aada2de818061846315
push id54507
push userbmo:dlee@mozilla.com
push dateTue, 18 Apr 2017 08:09:12 +0000
reviewersfrancois
bugs1357207, 1311935
milestone55.0a1
Bug 1357207 - Caching duration recorded to telemetry should be milli-second . r?francois In Bug 1311935, We change positive/negative cache duration from milli-second to second. But the value doesn't covert back to milli-second when store to telemetry(telemetry use milli-second). MozReview-Commit-ID: KR6xn9pwhUd
toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
--- a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
@@ -454,34 +454,34 @@ nsUrlClassifierUtils::ParseFindFullHashR
   for (auto& m : r.matches()) {
     nsCString tableNames;
     nsresult rv = ConvertThreatTypeToListNames(m.threat_type(), tableNames);
     if (NS_FAILED(rv)) {
       hasUnknownThreatType = true;
       continue; // Ignore un-convertable threat type.
     }
     auto& hash = m.threat().hash();
-    auto cacheDuration = m.cache_duration().seconds();
+    auto cacheDurationSec = m.cache_duration().seconds();
     aCallback->OnCompleteHashFound(nsCString(hash.c_str(), hash.length()),
-                                   tableNames, cacheDuration);
+                                   tableNames, cacheDurationSec);
 
     Telemetry::Accumulate(Telemetry::URLCLASSIFIER_POSITIVE_CACHE_DURATION,
-                          cacheDuration);
+                          cacheDurationSec * PR_MSEC_PER_SEC);
   }
 
   auto minWaitDuration = DurationToMs(r.minimum_wait_duration());
-  auto negCacheDuration = r.negative_cache_duration().seconds();
+  auto negCacheDurationSec = r.negative_cache_duration().seconds();
 
-  aCallback->OnResponseParsed(minWaitDuration, negCacheDuration);
+  aCallback->OnResponseParsed(minWaitDuration, negCacheDurationSec);
 
   Telemetry::Accumulate(Telemetry::URLCLASSIFIER_COMPLETION_ERROR,
                         hasUnknownThreatType ? UNKNOWN_THREAT_TYPE : SUCCESS);
 
   Telemetry::Accumulate(Telemetry::URLCLASSIFIER_NEGATIVE_CACHE_DURATION,
-                        negCacheDuration);
+                        negCacheDurationSec * PR_MSEC_PER_SEC);
 
   return NS_OK;
 }
 
 //////////////////////////////////////////////////////////
 // nsIObserver
 
 NS_IMETHODIMP