]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Also count TCP "distributed" queries and show them in the periodic stats
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 30 Aug 2023 13:07:44 +0000 (15:07 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 13 Sep 2023 11:20:54 +0000 (13:20 +0200)
Do note that the rules to increment various counters are a bit divergent if you compare TCP and UDP

pdns/recursordist/rec-main.cc
pdns/recursordist/rec-tcp.cc

index 2b0a6eb4a79d550a4a70e73a237d9c340c1b4f44..533a23ddcd7095f07377bc4407cdaf5779f3a19a 100644 (file)
@@ -1158,7 +1158,7 @@ static void doStats()
     for (const auto& threadInfo : RecThreadInfo::infos()) {
       if (threadInfo.isWorker()) {
         SLOG(g_log << Logger::Notice << "stats: thread " << idx << " has been distributed " << threadInfo.getNumberOfDistributedQueries() << " queries" << endl,
-             log->info(Logr::Info, "Queries handled by thread", "thread", Logging::Loggable(idx), "count", Logging::Loggable(threadInfo.getNumberOfDistributedQueries())));
+             log->info(Logr::Info, "Queries handled by thread", "thread", Logging::Loggable(idx), "tname", Logging::Loggable(threadInfo.getName()), "count", Logging::Loggable(threadInfo.getNumberOfDistributedQueries())));
         ++idx;
       }
     }
index 313a062bab66d01096a2dba1f67b2844bddce167..19ea2327f72dea0cd1a7b78ac1f4b7b376ac115c 100644 (file)
@@ -282,6 +282,7 @@ static void doProtobufLogQuery(bool logQuery, LocalStateHolder<LuaConfigItems>&
 
 static void doProcessTCPQuestion(std::unique_ptr<DNSComboWriter>& comboWriter, shared_ptr<TCPConnection>& conn, RunningTCPQuestionGuard& tcpGuard, int fileDesc)
 {
+  RecThreadInfo::self().incNumberOfDistributedQueries();
   struct timeval start
   {
   };
@@ -408,6 +409,9 @@ static void doProcessTCPQuestion(std::unique_ptr<DNSComboWriter>& comboWriter, s
     // We have read a proper query
     ++t_Counters.at(rec::Counter::qcounter);
     ++t_Counters.at(rec::Counter::tcpqcounter);
+    if (comboWriter->d_source.sin4.sin_family == AF_INET6) {
+      ++t_Counters.at(rec::Counter::ipv6qcounter);
+    }
 
     if (comboWriter->d_mdp.d_header.opcode == static_cast<unsigned>(Opcode::Notify)) {
       handleNotify(comboWriter, qname);