Bug 1460305 - Add DNS_PREMATURE_EVICTION telemetry probe. r=mcmanus
authorDaniel Stenberg <daniel@haxx.se>
Thu, 10 May 2018 06:20:00 -0400
changeset 472074 07140868fd017a4205d3fcc152be86f2a0b88268
parent 472073 0f63e6668a23b31bca944b91512ee94697f64f29
child 472075 35a563bca0998b6d478368208b5ea8feca790f2d
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1460305
milestone62.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 1460305 - Add DNS_PREMATURE_EVICTION telemetry probe. r=mcmanus Counts age of non-expired DNS cache entries being evicted.
netwerk/dns/nsHostResolver.cpp
toolkit/components/telemetry/Histograms.json
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -1681,16 +1681,21 @@ nsHostResolver::CompleteLookup(nsHostRec
             RefPtr<nsHostRecord> head = mEvictionQ.popFirst();
             mRecordDB.Remove(*static_cast<nsHostKey *>(head.get()));
 
             if (!head->negative) {
                 // record the age of the entry upon eviction.
                 TimeDuration age = TimeStamp::NowLoRes() - head->mValidStart;
                 Telemetry::Accumulate(Telemetry::DNS_CLEANUP_AGE,
                                       static_cast<uint32_t>(age.ToSeconds() / 60));
+                if (head->CheckExpiration(TimeStamp::Now()) !=
+                    nsHostRecord::EXP_EXPIRED) {
+                  Telemetry::Accumulate(Telemetry::DNS_PREMATURE_EVICTION,
+                                        static_cast<uint32_t>(age.ToSeconds() / 60));
+                }
             }
         }
     }
 
 #ifdef DNSQUERY_AVAILABLE
     // Unless the result is from TRR, resolve again to get TTL
     bool fromTRR = false;
     {
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -3226,16 +3226,27 @@
   "DNS_CLEANUP_AGE": {
     "record_in_processes": ["main"],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 1440,
     "n_buckets": 50,
     "description": "DNS Cache Entry Age at Removal Time (minutes)"
   },
+  "DNS_PREMATURE_EVICTION": {
+    "record_in_processes": ["main"],
+    "expires_in_version": "never",
+    "kind": "exponential",
+    "high": 1440,
+    "releaseChannelCollection": "opt-out",
+    "alert_emails": ["necko@mozilla.com", "dstenberg@mozilla.com"],
+    "bug_numbers": [1460305],
+    "n_buckets": 50,
+    "description": "DNS Cache Entry Age at Removal Time of non-expired entries (minutes)"
+  },
   "DNS_LOOKUP_TIME": {
     "record_in_processes": ["main"],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 60000,
     "releaseChannelCollection": "opt-out",
     "alert_emails": ["necko@mozilla.com", "pmcmanus@mozilla.com"],
     "n_buckets": 50,