]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
implement & document keeping track of authoritative latency distribution in the pdns_...
authorbert hubert <bert.hubert@powerdns.com>
Fri, 25 Sep 2015 07:54:18 +0000 (09:54 +0200)
committerbert hubert <bert.hubert@powerdns.com>
Fri, 25 Sep 2015 07:54:18 +0000 (09:54 +0200)
docs/markdown/recursor/stats.md
pdns/rec_channel_rec.cc
pdns/syncres.cc
pdns/syncres.hh

index 469f6a5f69ecfbf4bb398aa88ce434af5286eb94..0b4eb909d6442e82c73511a22baffae3c720cdd4 100644 (file)
@@ -7,6 +7,11 @@ The `rec_control get` command can be used to query the following statistics, eit
 * `answers1-10`: counts the number of queries answered within 10 milliseconds
 * `answers10-100`: counts the number of queries answered within 100 milliseconds
 * `answers100-1000`: counts the number of queries answered within 1 second
+* `auth-answers-slow`: counts the number of queries answered by auths after 1 second (4.0)
+* `auth-answers0-1`: counts the number of queries answered by auths within 1 millisecond (4.0)
+* `auth-answers1-10`: counts the number of queries answered by auths within 10 milliseconds (4.0)
+* `auth-answers10-100`: counts the number of queries answered by auths within 100 milliseconds (4.0)
+* `auth-answers100-1000`: counts the number of queries answered by auths within 1 second (4.0)
 * `cache-bytes`: size of the cache in bytes (since 3.3.1)
 * `cache-entries`: shows the number of entries in the cache
 * `cache-hits`: counts the number of cache hits since starting, this does **not** include hits that got answered from the packet-cache
index a3a23ba73007331f6aa7fc483ae1bd6e109cbe3a..55ab3cfa05c272128ea8f5c00cfcf8d89a60eb0e 100644 (file)
@@ -523,6 +523,12 @@ RecursorControlParser::RecursorControlParser()
   addGetStat("answers100-1000", &g_stats.answers100_1000);
   addGetStat("answers-slow", &g_stats.answersSlow);
 
+  addGetStat("auth-answers0-1", &g_stats.authAnswers0_1);
+  addGetStat("auth-answers1-10", &g_stats.authAnswers1_10);
+  addGetStat("auth-answers10-100", &g_stats.authAnswers10_100);
+  addGetStat("auth-answers100-1000", &g_stats.authAnswers100_1000);
+  addGetStat("auth-answers-slow", &g_stats.authAnswersSlow);
+
   addGetStat("qa-latency", doGetAvgLatencyUsec);
   addGetStat("unexpected-packets", &g_stats.unexpectedCount);
   addGetStat("case-mismatches", &g_stats.caseMismatchCount);
index acaab1ba71d24c1aa807a86fd90141a80e195bd9..7f1c4a88dd676237c74ef09993a9fcf66c4284d6 100644 (file)
@@ -1,6 +1,6 @@
 /*
     PowerDNS Versatile Database Driven Nameserver
-    Copyright (C) 2003 - 2014  PowerDNS.COM BV
+    Copyright (C) 2003 - 2015  PowerDNS.COM BV
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 as published
@@ -77,6 +77,20 @@ SyncRes::LogMode SyncRes::s_lm;
 bool SyncRes::s_noEDNSPing;
 bool SyncRes::s_noEDNS;
 
+void accountAuthLatency(int usec)
+{
+  if(usec < 1000)
+    g_stats.authAnswers0_1++;
+  else if(usec < 10000)
+    g_stats.authAnswers1_10++;
+  else if(usec < 100000)
+    g_stats.authAnswers10_100++;
+  else if(usec < 1000000)
+    g_stats.authAnswers100_1000++;
+  else
+    g_stats.authAnswersSlow++;
+}
+
 SyncRes::SyncRes(const struct timeval& now) :  d_outqueries(0), d_tcpoutqueries(0), d_throttledqueries(0), d_timeouts(0), d_unreachables(0),
                                               d_totUsec(0), d_now(now),
                                               d_cacheonly(false), d_nocache(false),   d_doEDNS0(false), d_lm(s_lm)
@@ -978,6 +992,7 @@ int SyncRes::doResolveAt(set<DNSName> nameservers, DNSName auth, bool flawedNSSe
              throw ImmediateServFailException("Query killed by policy");
 
            d_totUsec += lwr.d_usec;
+           accountAuthLatency(lwr.d_usec);
            if(resolveret != 1) {
               if(resolveret==0) {
                 LOG(prefix<<qname.toString()<<": timeout resolving after "<<lwr.d_usec/1000.0<<"msec "<< (doTCP ? "over TCP" : "")<<endl);
index 92b3d8e6bcf7a20559da0895a4aa10e3426769ba..b9147222c041a33703d5f5b2c6772c3df401b01a 100644 (file)
@@ -545,6 +545,7 @@ struct RecursorStats
   uint64_t nxDomains;
   uint64_t noErrors;
   uint64_t answers0_1, answers1_10, answers10_100, answers100_1000, answersSlow;
+  uint64_t authAnswers0_1, authAnswers1_10, authAnswers10_100, authAnswers100_1000, authAnswersSlow;
   double avgLatencyUsec;
   uint64_t qcounter;     // not increased for unauth packets
   uint64_t ipv6qcounter;