From: Otto Moerbeek Date: Tue, 6 Dec 2022 09:09:41 +0000 (+0100) Subject: Since we now register stats in the main startup code, no need to do X-Git-Tag: dnsdist-1.8.0-rc1~165^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3a586a4cd4ccec210e5f1402f9b81a2b5ffc2cf;p=thirdparty%2Fpdns.git Since we now register stats in the main startup code, no need to do it per-thread --- diff --git a/pdns/rec-carbon.cc b/pdns/rec-carbon.cc index 8e28309b2b..43b1df9570 100644 --- a/pdns/rec-carbon.cc +++ b/pdns/rec-carbon.cc @@ -39,7 +39,6 @@ void doCarbonDump(void*) config.instance_name = "recursor"; } - registerAllStats(); PacketBuffer msg; for (const auto& carbonServer : config.servers) { ComboAddress remote(carbonServer, 2003); diff --git a/pdns/rec-snmp.cc b/pdns/rec-snmp.cc index 3972af751b..7ffce2acb1 100644 --- a/pdns/rec-snmp.cc +++ b/pdns/rec-snmp.cc @@ -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)); diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index cae909fd02..e58fc441a7 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -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) diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index fbc971e5b7..21ddd01ee9 100644 --- a/pdns/ws-recursor.cc +++ b/pdns/ws-recursor.cc @@ -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