From: Otto Moerbeek Date: Wed, 30 Aug 2023 13:07:44 +0000 (+0200) Subject: Also count TCP "distributed" queries and show them in the periodic stats X-Git-Tag: rec-5.0.0-alpha2~58^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bed6715d5d0b7281c06767898857e7775b98741;p=thirdparty%2Fpdns.git Also count TCP "distributed" queries and show them in the periodic stats Do note that the rules to increment various counters are a bit divergent if you compare TCP and UDP --- diff --git a/pdns/recursordist/rec-main.cc b/pdns/recursordist/rec-main.cc index 2b0a6eb4a7..533a23ddcd 100644 --- a/pdns/recursordist/rec-main.cc +++ b/pdns/recursordist/rec-main.cc @@ -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; } } diff --git a/pdns/recursordist/rec-tcp.cc b/pdns/recursordist/rec-tcp.cc index 313a062bab..19ea2327f7 100644 --- a/pdns/recursordist/rec-tcp.cc +++ b/pdns/recursordist/rec-tcp.cc @@ -282,6 +282,7 @@ static void doProtobufLogQuery(bool logQuery, LocalStateHolder& static void doProcessTCPQuestion(std::unique_ptr& comboWriter, shared_ptr& conn, RunningTCPQuestionGuard& tcpGuard, int fileDesc) { + RecThreadInfo::self().incNumberOfDistributedQueries(); struct timeval start { }; @@ -408,6 +409,9 @@ static void doProcessTCPQuestion(std::unique_ptr& 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(Opcode::Notify)) { handleNotify(comboWriter, qname);