("Bad/missing Server Cookie")
;
+static const std::array<std::string, 10> rcodes_short_s = {
+ "noerror",
+ "formerr",
+ "servfail",
+ "nxdomain",
+ "notimp",
+ "refused",
+ "yxdomain",
+ "yxrrset",
+ "nxrrset",
+ "notauth",
+};
+
std::string RCode::to_s(uint8_t rcode) {
if (rcode > 0xF)
return std::string("ErrOutOfRange");
return ERCode::to_s(rcode);
}
+std::string RCode::to_short_s(uint8_t rcode) {
+ if (rcode >= rcodes_short_s.size()) {
+ return "rcode" + std::to_string(rcode);
+ }
+ return rcodes_short_s.at(rcode);
+}
+
std::string ERCode::to_s(uint8_t rcode) {
if (rcode > RCode::rcodes_s.size()-1)
return std::string("Err#")+std::to_string(rcode);
public:
enum rcodes_ { NoError=0, FormErr=1, ServFail=2, NXDomain=3, NotImp=4, Refused=5, YXDomain=6, YXRRSet=7, NXRRSet=8, NotAuth=9, NotZone=10};
static std::string to_s(uint8_t rcode);
+ static std::string to_short_s(uint8_t rcode);
static std::vector<std::string> rcodes_s;
};
return entries;
}
+static StatsMap toAuthRCodeStatsMap(const string& name, const std::array<pdns::stat_t, 16>& v)
+{
+ const string pbasename = getPrometheusName(name);
+ StatsMap entries;
+
+ uint8_t n = 0;
+ for (const auto& entry : v) {
+ const auto key = RCode::to_short_s(n);
+ std::string pname = pbasename + "{rcode=\"" + key + "\"}";
+ entries.emplace("auth-" + key + "-answers", StatsMapEntry{pname, std::to_string(entry)});
+ n++;
+ }
+ return entries;
+}
+
static StatsMap toCPUStatsMap(const string& name)
{
const string pbasename = getPrometheusName(name);
addGetStat("proxy-mapping-total", []() {
return toProxyMappingStatsMap("proxy-mapping-total");
});
+ addGetStat("auth-rcode-answers", []() {
+ return toAuthRCodeStatsMap("auth-rcode-answers", g_stats.authRCode);
+ });
}
void registerAllStats()
d_totUsec += lwr.d_usec;
accountAuthLatency(lwr.d_usec, remoteIP.sin4.sin_family);
+ ++g_stats.authRCode[lwr.d_rcode];
if (!dontThrottle) {
auto dontThrottleNames = g_dontThrottleNames.getLocal();
pdns::stat_t dns64prefixanswers{0};
pdns::stat_t maintenanceUsec{0};
pdns::stat_t maintenanceCalls{0};
+ std::array<pdns::stat_t, 16> authRCode;
RecursorStats() :
answers("answers", { 1000, 10000, 100000, 1000000 }),
{"proxy-mapping-total-n-0",
MetricDefinition(PrometheusMetricType::multicounter,
"Number of queries matching proxyMappings")},
+
+ // For multicounters, state the first
+ {"auth-noerror-answers",
+ MetricDefinition(PrometheusMetricType::multicounter,
+ "Count of RCodes returned by authoritative servers")},
};
#define CHECK_PROMETHEUS_METRICS 0