]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: keep track of max depth reaches and report it if !quiet 12898/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 8 Jun 2023 10:44:17 +0000 (12:44 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 8 Jun 2023 10:44:17 +0000 (12:44 +0200)
This is enough for now, mostly a metric only interesting to devs

pdns/recursordist/pdns_recursor.cc
pdns/recursordist/syncres.cc
pdns/recursordist/syncres.hh

index e1dbcf7bd414542cf5b835e8d0341b9a427c62fb..644541d639b6fd749c63f03ed3d6c8e8c9dfe822 100644 (file)
@@ -1791,6 +1791,7 @@ void startDoResolve(void* p) // NOLINT(readability-function-cognitive-complexity
           g_log << ", dnssec=" << sr.getValidationState();
         }
         g_log << " answer-is-variable=" << sr.wasVariable() << ", into-packetcache=" << intoPC;
+        g_log << " maxdepth=" << sr.d_maxdepth;
         g_log << endl;
       }
       else {
@@ -1807,7 +1808,8 @@ void startDoResolve(void* p) // NOLINT(readability-function-cognitive-complexity
                         "rcode", Logging::Loggable(res),
                         "validationState", Logging::Loggable(sr.getValidationState()),
                         "answer-is-variable", Logging::Loggable(sr.wasVariable()),
-                        "into-packetcache", Logging::Loggable(intoPC));
+                        "into-packetcache", Logging::Loggable(intoPC),
+                        "maxdepth", Logging::Loggable(sr.d_maxdepth));
       }
     }
 
index a2cba559bfbb019f3d10fb6c56999511616c3a36..c6be854ae189ab912cdd8892a813774cb0652522 100644 (file)
@@ -1824,6 +1824,7 @@ int SyncRes::doResolveNoQNameMinimization(const DNSName& qname, const QType qtyp
 
   LOG(prefix << qname << ": Wants " << (d_doDNSSEC ? "" : "NO ") << "DNSSEC processing, " << (d_requireAuthData ? "" : "NO ") << "auth data required by query for " << qtype << endl);
 
+  d_maxdepth = std::max(d_maxdepth, depth);
   if (s_maxdepth > 0) {
     auto bound = getAdjustedRecursionBound();
     // Use a stricter bound if throttling
index 539216bc3b09f51ddb3eb4e29f5a9af448afed1d..c61e78a0de68ed86d9e2fdb2e3c3d10aeb1d5d82 100644 (file)
@@ -570,6 +570,7 @@ public:
   unsigned int d_timeouts;
   unsigned int d_unreachables;
   unsigned int d_totUsec;
+  unsigned int d_maxdepth{0};
   // Initialized ony once, as opposed to d_now which gets updated after outgoing requests
   const struct timeval d_fixednow;