From: Pieter Lexis Date: Wed, 17 Jun 2020 07:49:54 +0000 (+0200) Subject: Add XFR queue statistic X-Git-Tag: dnsdist-1.6.0-alpha0~28^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c0cc85433e3da85637785f547ce34f1629a858c5;p=thirdparty%2Fpdns.git Add XFR queue statistic --- diff --git a/pdns/common_startup.cc b/pdns/common_startup.cc index fe4994cc13..d476a6f2e7 100644 --- a/pdns/common_startup.cc +++ b/pdns/common_startup.cc @@ -371,6 +371,7 @@ void declareStats(void) S.declare("latency","Average number of microseconds needed to answer a question", getLatency, StatType::gauge); S.declare("timedout-packets","Number of packets which weren't answered within timeout set"); S.declare("security-status", "Security status based on regular polling", StatType::gauge); + S.declare("xfr-queue", "Size of the queue of domains to be XFRd", [](const string&) { return Communicator.getSuckRequestsWaiting(); }, StatType::gauge); S.declareDNSNameQTypeRing("queries","UDP Queries Received"); S.declareDNSNameQTypeRing("nxdomain-queries","Queries for non-existent records within existent domains"); S.declareDNSNameQTypeRing("noerror-queries","Queries for existing records, but for type we don't have"); diff --git a/pdns/communicator.hh b/pdns/communicator.hh index 9d718ba1f5..366ec98727 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -170,6 +170,7 @@ public: void sendNotification(int sock, const DNSName &domain, const ComboAddress& remote, uint16_t id, UeberBackend* B); bool notifyDomain(const DNSName &domain, UeberBackend* B); vector > getSuckRequests(); + size_t getSuckRequestsWaiting(); private: void loadArgsIntoSet(const char *listname, set &listset); void makeNotifySockets(); diff --git a/pdns/slavecommunicator.cc b/pdns/slavecommunicator.cc index d46020e147..1782bb99b1 100644 --- a/pdns/slavecommunicator.cc +++ b/pdns/slavecommunicator.cc @@ -1013,3 +1013,8 @@ vector > CommunicatorClass::getSuckRequests() { } return ret; } + +size_t CommunicatorClass::getSuckRequestsWaiting() { + std::lock_guard l(d_lock); + return d_suckdomains.size(); +} diff --git a/regression-tests.nobackend/counters/expected_result b/regression-tests.nobackend/counters/expected_result index 917a0bc929..ce6b57c5c4 100644 --- a/regression-tests.nobackend/counters/expected_result +++ b/regression-tests.nobackend/counters/expected_result @@ -62,3 +62,4 @@ udp4-queries=2 udp6-answers-bytes=132 udp6-answers=2 udp6-queries=2 +xfr-queue=0