]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Disable cumul stats by default except for API plus some other
authorOtto <otto.moerbeek@open-xchange.com>
Tue, 29 Jun 2021 09:03:27 +0000 (11:03 +0200)
committerOtto <otto.moerbeek@open-xchange.com>
Tue, 29 Jun 2021 13:07:44 +0000 (15:07 +0200)
assorted review comments.

pdns/pdns_recursor.cc
pdns/rec_channel.hh
pdns/rec_channel_rec.cc
pdns/recursordist/docs/settings.rst
pdns/ws-recursor.cc

index af1294f8061c3def3f4f7a2dcd27e5becfeca135..f1204784ddf1b534f873dc6fb1bd9ee9d3bb5272 100644 (file)
@@ -2818,10 +2818,9 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
         bool cacheHit = checkForCacheHit(qnameParsed, dc->d_tag, conn->data, qname, qtype, qclass, g_now, response, dc->d_qhash, pbData, true, dc->d_source);
 
         if (cacheHit) {
-          struct timeval now;
-          Utility::gettimeofday(&now, nullptr);
           if (t_protobufServers && dc->d_logResponse && !(luaconfsLocal->protobufExportConfig.taggedOnly && pbData && !pbData->d_tagged)) {
-            protobufLogResponse(dh, luaconfsLocal, pbData, now, true, dc->d_source, dc->d_destination, dc->d_ednssubnet, dc->d_uuid, dc->d_requestorId, dc->d_deviceId, dc->d_deviceName);
+            struct timeval tv{0, 0};
+            protobufLogResponse(dh, luaconfsLocal, pbData, tv, true, dc->d_source, dc->d_destination, dc->d_ednssubnet, dc->d_uuid, dc->d_requestorId, dc->d_deviceId, dc->d_deviceName);
           }
 
           if (!g_quiet) {
@@ -2830,6 +2829,7 @@ static void handleRunningTCPQuestion(int fd, FDMultiplexer::funcparam_t& var)
 
           bool hadError = sendResponseOverTCP(dc, response);
           finishTCPReply(dc, hadError, false);
+          struct timeval now;
           Utility::gettimeofday(&now, nullptr);
           uint64_t spentUsec = uSec(now - start);
           g_stats.cumulativeAnswers(spentUsec);
@@ -5798,26 +5798,28 @@ int main(int argc, char **argv)
 
     ::arg().set("include-dir","Include *.conf files from this directory")="";
     ::arg().set("security-poll-suffix","Domain name from which to query security update notifications")="secpoll.powerdns.com.";
-    
+
     ::arg().setSwitch("reuseport","Enable SO_REUSEPORT allowing multiple recursors processes to listen to 1 address")="no";
 
     ::arg().setSwitch("snmp-agent", "If set, register as an SNMP agent")="no";
     ::arg().set("snmp-master-socket", "If set and snmp-agent is set, the socket to use to register to the SNMP daemon (deprecated)")="";
     ::arg().set("snmp-daemon-socket", "If set and snmp-agent is set, the socket to use to register to the SNMP daemon")="";
 
-    std::string defaultDisabledStats = "cache-bytes, packetcache-bytes, special-memory-usage";
+    std::string defaultAPIDisabledStats = "cache-bytes, packetcache-bytes, special-memory-usage";
     for (size_t idx = 0; idx < 32; idx++) {
-      defaultDisabledStats += ", ecs-v4-response-bits-" + std::to_string(idx + 1);
+      defaultAPIDisabledStats += ", ecs-v4-response-bits-" + std::to_string(idx + 1);
     }
     for (size_t idx = 0; idx < 128; idx++) {
-      defaultDisabledStats += ", ecs-v6-response-bits-" + std::to_string(idx + 1);
+      defaultAPIDisabledStats += ", ecs-v6-response-bits-" + std::to_string(idx + 1);
     }
-    ::arg().set("stats-api-blacklist", "List of statistics that are disabled when retrieving the complete list of statistics via the API (deprecated)")=defaultDisabledStats;
+    std::string defaultDisabledStats = defaultAPIDisabledStats + ", cumul-answers, cumul-auth4answers, cumul-auth6answers";
+
+    ::arg().set("stats-api-blacklist", "List of statistics that are disabled when retrieving the complete list of statistics via the API (deprecated)")=defaultAPIDisabledStats;
     ::arg().set("stats-carbon-blacklist", "List of statistics that are prevented from being exported via Carbon (deprecated)")=defaultDisabledStats;
     ::arg().set("stats-rec-control-blacklist", "List of statistics that are prevented from being exported via rec_control get-all (deprecated)")=defaultDisabledStats;
     ::arg().set("stats-snmp-blacklist", "List of statistics that are prevented from being exported via SNMP (deprecated)")=defaultDisabledStats;
 
-    ::arg().set("stats-api-disabled-list", "List of statistics that are disabled when retrieving the complete list of statistics via the API")=defaultDisabledStats;
+    ::arg().set("stats-api-disabled-list", "List of statistics that are disabled when retrieving the complete list of statistics via the API")=defaultAPIDisabledStats;
     ::arg().set("stats-carbon-disabled-list", "List of statistics that are prevented from being exported via Carbon")=defaultDisabledStats;
     ::arg().set("stats-rec-control-disabled-list", "List of statistics that are prevented from being exported via rec_control get-all")=defaultDisabledStats;
     ::arg().set("stats-snmp-disabled-list", "List of statistics that are prevented from being exported via SNMP")=defaultDisabledStats;
index 7b197665e8c1b73065d6524b4d6c2db845a31b47..737df8438131d64313d9259cc4d8b9a28a261c98 100644 (file)
@@ -95,7 +95,7 @@ struct StatsMapEntry {
   std::string d_value;
 };
 
-class SimpleNaturalCompare
+class PrefixDashNumberCompare
 {
 private:
   static std::pair<std::string, std::string> prefixAndTrailingNum(const std::string& a);
@@ -103,7 +103,7 @@ public:
   bool operator()(const std::string& a, const std::string& b) const;
 };
 
-typedef std::map<std::string, StatsMapEntry, SimpleNaturalCompare> StatsMap;
+typedef std::map<std::string, StatsMapEntry, PrefixDashNumberCompare> StatsMap;
 
 StatsMap getAllStatsMap(StatComponent component);
 
index 0c6b223eaf1209acf4643727304d7d887c99eb29..e1eb007f582c6236fdc4c626520dcba05a14ee4e 100644 (file)
@@ -40,7 +40,7 @@
 #include "namespaces.hh"
 #include "rec-taskqueue.hh"
 
-std::pair<std::string, std::string> SimpleNaturalCompare::prefixAndTrailingNum(const std::string& a)
+std::pair<std::string, std::string> PrefixDashNumberCompare::prefixAndTrailingNum(const std::string& a)
 {
   auto i = a.length();
   if (i == 0) {
@@ -59,7 +59,7 @@ std::pair<std::string, std::string> SimpleNaturalCompare::prefixAndTrailingNum(c
   return make_pair(a.substr(0, i + 1), a.substr(i + 1, a.size() - i - 1));
 }
 
-bool SimpleNaturalCompare::operator()(const std::string& a, const std::string& b) const
+bool PrefixDashNumberCompare::operator()(const std::string& a, const std::string& b) const
 {
   auto [aprefix, anum] = prefixAndTrailingNum(a);
   auto [bprefix, bnum] = prefixAndTrailingNum(b);
index d9465ab4d7241aaad4a07ce5e4c1ae7ebd15ec68..75d73b83e8a0f8c7c782e2f06496ee83b747b205 100644 (file)
@@ -1809,7 +1809,7 @@ These statistics can still be retrieved individually by specifically asking for
 .. versionadded:: 4.5.0
 
 -  String
--  Default: "cache-bytes, packetcache-bytes, special-memory-usage, ecs-v4-response-bits-*, ecs-v6-response-bits-*"
+-  Default: "cache-bytes, packetcache-bytes, special-memory-usage, ecs-v4-response-bits-*, ecs-v6-response-bits-*, cumul-answers-*, cumul-auth4answers-*, cumul-auth6answers-*"
 
 A list of comma-separated statistic names, that are prevented from being exported via carbon for performance reasons.
 
@@ -1828,7 +1828,7 @@ A list of comma-separated statistic names, that are prevented from being exporte
 .. versionadded:: 4.5.0
 
 -  String
--  Default: "cache-bytes, packetcache-bytes, special-memory-usage, ecs-v4-response-bits-*, ecs-v6-response-bits-*"
+-  Default: "cache-bytes, packetcache-bytes, special-memory-usage, ecs-v4-response-bits-*, ecs-v6-response-bits-*, cumul-answers-*, cumul-auth4answers-*, cumul-auth6answers-*"
 
 A list of comma-separated statistic names, that are disabled when retrieving the complete list of statistics via `rec_control get-all`, for performance reasons.
 These statistics can still be retrieved individually.
index 71566be97146e52dc0590d6601f67951bf3ae009..56f9722dc55d86d48ef8ea9c3d6552dd57428de1 100644 (file)
@@ -1048,7 +1048,7 @@ const std::map<std::string, MetricDefinition> MetricDefinitionStorage::metrics =
                      "histogram of authoritative answer times over IPV6")},
 };
 
-#define CHECK_PROMETHEUS_METRICS 1
+#define CHECK_PROMETHEUS_METRICS 0
 
 #if CHECK_PROMETHEUS_METRICS
 static void validatePrometheusMetrics()