Skip to content

Commit

Permalink
Merge pull request #13322 from Habbie/ixfrdist-notify-in
Browse files Browse the repository at this point in the history
ixfrdist: add NOTIFY receive support
  • Loading branch information
Habbie committed Oct 20, 2023
2 parents 01cf968 + 554796c commit 42240b1
Show file tree
Hide file tree
Showing 5 changed files with 219 additions and 35 deletions.
13 changes: 13 additions & 0 deletions pdns/ixfrdist-stats.cc
Expand Up @@ -85,6 +85,19 @@ std::string ixfrdistStats::getStats() {
stats<<prefix<<"ixfr_failures_total{domain=\""<<d.first<<"\"} "<<d.second.numIXFRFailures<<std::endl;
}

if (!notimpStats.empty()) {
stats<<"# HELP "<<prefix<<"notimp An unimplemented opcode"<<std::endl;
stats<<"# TYPE "<<prefix<<"notimp counter"<<std::endl;
}

for (std::size_t i = 0; i < notimpStats.size() ; i++) {
auto val = notimpStats.at(i).load();

if (val > 0) {
stats<<prefix<<"notimp{opcode=\""<<Opcode::to_s(i)<<"\"} "<<val<<std::endl;
}
}

stats<<"# HELP "<<prefix<<"unknown_domain_inqueries_total Number of queries received for domains unknown to us"<<std::endl;
stats<<"# TYPE "<<prefix<<"unknown_domain_inqueries_total counter"<<std::endl;
stats<<prefix<<"unknown_domain_inqueries_total "<<progStats.unknownDomainInQueries<<std::endl;
Expand Down
7 changes: 7 additions & 0 deletions pdns/ixfrdist-stats.hh
Expand Up @@ -24,6 +24,7 @@
#include <map>
#include <string>

#include "dns.hh"
#include "dnsname.hh"
#include "pdnsexception.hh"

Expand Down Expand Up @@ -70,6 +71,11 @@ class ixfrdistStats {
progStats.unknownDomainInQueries += 1;
}

void incrementNotImplemented(uint8_t opcode)
{
notimpStats.at(opcode) ++;
}

private:
class perDomainStat {
public:
Expand All @@ -93,6 +99,7 @@ class ixfrdistStats {
};

std::map<DNSName, perDomainStat> domainStats;
std::array<std::atomic<uint64_t>, 16> notimpStats;
programStats progStats;

std::map<DNSName, perDomainStat>::iterator getRegisteredDomain(const DNSName& d) {
Expand Down

0 comments on commit 42240b1

Please sign in to comment.