From: Otto Moerbeek Date: Thu, 8 Jun 2023 09:30:01 +0000 (+0200) Subject: Keep track of metrics for NOD and UDR events. X-Git-Tag: rec-4.10.0-alpha0~6^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4387eb5ea84198a4f13261684dfb32cfa99195f1;p=thirdparty%2Fpdns.git Keep track of metrics for NOD and UDR events. While there, change level of ndr logs to Notice, it was Debug before --- diff --git a/pdns/recursordist/pdns_recursor.cc b/pdns/recursordist/pdns_recursor.cc index e1dbcf7bd4..87d639d018 100644 --- a/pdns/recursordist/pdns_recursor.cc +++ b/pdns/recursordist/pdns_recursor.cc @@ -590,6 +590,7 @@ static bool nodCheckNewDomain(Logr::log_t nodlogger, const DNSName& dname) SLOG(g_log << Logger::Notice << "Newly observed domain nod=" << dname << endl, nodlogger->info(Logr::Notice, "New domain observed")); } + t_Counters.at(rec::Counter::nodCount)++; ret = true; } } @@ -628,12 +629,13 @@ static bool udrCheckUniqueDNSRecord(Logr::log_t nodlogger, const DNSName& dname, if (g_udrLog) { // This should also probably log to a dedicated file. SLOG(g_log << Logger::Notice << "Unique response observed: qname=" << dname << " qtype=" << QType(qtype) << " rrtype=" << QType(record.d_type) << " rrname=" << record.d_name << " rrcontent=" << record.getContent()->getZoneRepresentation() << endl, - nodlogger->info(Logr::Debug, "New response observed", + nodlogger->info(Logr::Notice, "New response observed", "qtype", Logging::Loggable(QType(qtype)), "rrtype", Logging::Loggable(QType(record.d_type)), "rrname", Logging::Loggable(record.d_name), "rrcontent", Logging::Loggable(record.getContent()->getZoneRepresentation()));); } + t_Counters.at(rec::Counter::udrCount)++; ret = true; } } diff --git a/pdns/recursordist/rec-tcounters.hh b/pdns/recursordist/rec-tcounters.hh index 7d59bde46c..23e17efe56 100644 --- a/pdns/recursordist/rec-tcounters.hh +++ b/pdns/recursordist/rec-tcounters.hh @@ -94,6 +94,8 @@ enum class Counter : uint8_t dns64prefixanswers, maintenanceUsec, maintenanceCalls, + nodCount, + udrCount, numberOfCounters }; diff --git a/pdns/recursordist/rec_channel_rec.cc b/pdns/recursordist/rec_channel_rec.cc index f2a7d628e7..ce807e542c 100644 --- a/pdns/recursordist/rec_channel_rec.cc +++ b/pdns/recursordist/rec_channel_rec.cc @@ -1501,6 +1501,9 @@ static void registerAllStats1() addGetStat("maintenance-usec", [] { return g_Counters.sum(rec::Counter::maintenanceUsec); }); addGetStat("maintenance-calls", [] { return g_Counters.sum(rec::Counter::maintenanceCalls); }); + addGetStat("nod-count", [] { return g_Counters.sum(rec::Counter::nodCount); }); + addGetStat("udr-count", [] { return g_Counters.sum(rec::Counter::udrCount); }); + /* make sure that the ECS stats are properly initialized */ SyncRes::clearECSStats(); for (size_t idx = 0; idx < SyncRes::s_ecsResponsesBySubnetSize4.size(); idx++) {