]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Keep track of metrics for NOD and UDR events.
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 8 Jun 2023 09:30:01 +0000 (11:30 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 8 Jun 2023 10:04:28 +0000 (12:04 +0200)
While there, change level of ndr logs to Notice, it was Debug before

pdns/recursordist/pdns_recursor.cc
pdns/recursordist/rec-tcounters.hh
pdns/recursordist/rec_channel_rec.cc

index e1dbcf7bd414542cf5b835e8d0341b9a427c62fb..87d639d0188ceaaec2f2583bc604dfcaf189276c 100644 (file)
@@ -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;
     }
   }
index 7d59bde46cfc91d4429d444c13bf65a45be438d6..23e17efe5667857c34025ee14c8f789544168e03 100644 (file)
@@ -94,6 +94,8 @@ enum class Counter : uint8_t
   dns64prefixanswers,
   maintenanceUsec,
   maintenanceCalls,
+  nodCount,
+  udrCount,
 
   numberOfCounters
 };
index f2a7d628e78dc453ee7f19c6a96bbccd382ea683..ce807e542cc4102ab6100a6c6ad1a1823a6eae2c 100644 (file)
@@ -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++) {