]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Since we now register stats in the main startup code, no need to do
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 6 Dec 2022 09:09:41 +0000 (10:09 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 12 Dec 2022 12:14:04 +0000 (13:14 +0100)
it per-thread

pdns/rec-carbon.cc
pdns/rec-snmp.cc
pdns/rec_channel_rec.cc
pdns/ws-recursor.cc

index 8e28309b2b7bf33c8a4b2724bf63c8c6b40c9346..43b1df9570ca594bf98150dc277f731c8f76ca5a 100644 (file)
@@ -39,7 +39,6 @@ void doCarbonDump(void*)
       config.instance_name = "recursor";
     }
 
-    registerAllStats();
     PacketBuffer msg;
     for (const auto& carbonServer : config.servers) {
       ComboAddress remote(carbonServer, 2003);
index 3972af751ba4b7450216efd10091aa135abbffce..7ffce2acb184e15e209f853312f9181f1c5ae030 100644 (file)
@@ -271,10 +271,6 @@ RecursorSNMPAgent::RecursorSNMPAgent(const std::string& name, const std::string&
   SNMPAgent(name, masterSocket)
 {
 #ifdef HAVE_NET_SNMP
-  /* This is done so that the statistics maps are
-     initialized. */
-  registerAllStats();
-
   registerCounter64Stat("questions", questionsOID, OID_LENGTH(questionsOID));
   registerCounter64Stat("ipv6-questions", ipv6QuestionsOID, OID_LENGTH(ipv6QuestionsOID));
   registerCounter64Stat("tcp-questions", tcpQuestionsOID, OID_LENGTH(tcpQuestionsOID));
index cae909fd026071aa28f4fbfaf2962257e1a2d178..e58fc441a704d427011b4bdbbcebffa701e228dd 100644 (file)
@@ -1593,16 +1593,13 @@ static void registerAllStats1()
 
 void registerAllStats()
 {
-  static std::once_flag s_once;
-  std::call_once(s_once, []() {
-    try {
-      registerAllStats1();
-    }
-    catch (...) {
-      g_log << Logger::Critical << "Could not add stat entries" << endl;
-      exit(1);
-    }
-  });
+  try {
+    registerAllStats1();
+  }
+  catch (...) {
+    g_log << Logger::Critical << "Could not add stat entries" << endl;
+    exit(1);
+  }
 }
 
 void doExitGeneric(bool nicely)
index fbc971e5b72707cf42b8038ea7f6fbfd604c576d..21ddd01ee998c8b29b59a51fea7d5e81f9d6882a 100644 (file)
@@ -455,8 +455,6 @@ static void prometheusMetrics(HttpRequest* req, HttpResponse* resp)
   if (req->method != "GET")
     throw HttpMethodNotAllowedException();
 
-  registerAllStats();
-
   std::ostringstream output;
 
   // Argument controls disabling of any stats. So
@@ -1194,8 +1192,6 @@ static void validatePrometheusMetrics()
 
 RecursorWebServer::RecursorWebServer(FDMultiplexer* fdm)
 {
-  registerAllStats();
-
 #if CHECK_PROMETHEUS_METRICS
   validatePrometheusMetrics();
 #endif