From: Otto Date: Tue, 20 Jul 2021 08:47:51 +0000 (+0200) Subject: Expose almost-expired metrics X-Git-Tag: dnsdist-1.7.0-alpha1~64^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75fa71b3a31fc435e2416053396db9bcc5c42222;p=thirdparty%2Fpdns.git Expose almost-expired metrics --- diff --git a/pdns/rec-snmp.cc b/pdns/rec-snmp.cc index 745b48f145..a63dd78c96 100644 --- a/pdns/rec-snmp.cc +++ b/pdns/rec-snmp.cc @@ -132,6 +132,9 @@ static const oid aggressiveNSECCacheNSECWCHitsOID[] = { RECURSOR_STATS_OID, 111 static const oid aggressiveNSECCacheNSEC3WCHitsOID[] = { RECURSOR_STATS_OID, 112 }; static const oid dotOutqueriesOID [] = { RECURSOR_STATS_OID, 113 }; static const oid dns64PrefixAnswers [] = { RECURSOR_STATS_OID, 114 }; +static const oid almostExpiredPushed [] = { RECURSOR_STATS_OID, 115 }; +static const oid almostExpiredRun [] = { RECURSOR_STATS_OID, 116 }; +static const oid almostExpiredExceptions [] = { RECURSOR_STATS_OID, 117 }; static std::unordered_map s_statsMap; @@ -355,5 +358,8 @@ RecursorSNMPAgent::RecursorSNMPAgent(const std::string& name, const std::string& registerCounter64Stat("aggressive-nsec-cache-nsec-wc3-hits", aggressiveNSECCacheNSEC3WCHitsOID, OID_LENGTH(aggressiveNSECCacheNSEC3WCHitsOID)); registerCounter64Stat("dot-outqueries", dotOutqueriesOID, OID_LENGTH(dotOutqueriesOID)); registerCounter64Stat("dns64-prefix-answers", dns64PrefixAnswers, OID_LENGTH(dns64PrefixAnswers)); + registerCounter64Stat("almost-expired-pushed", almostExpiredPushed, OID_LENGTH(almostExpiredPushed)); + registerCounter64Stat("almost-expired-run", almostExpiredRun, OID_LENGTH(almostExpiredRun)); + registerCounter64Stat("almost-expired-exceptions", almostExpiredExceptions, OID_LENGTH(almostExpiredExceptions)); #endif /* HAVE_NET_SNMP */ } diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index 17dff3c155..0c8928836f 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -1366,6 +1366,10 @@ static void registerAllStats1() addGetStat("dns64-prefix-answers", &g_stats.dns64prefixanswers); + addGetStat("almost-expired-pushed", []() { return getAlmostExpiredTasksPushed(); }); + addGetStat("almost-expired-run", []() { return getAlmostExpiredTasksRun(); }); + addGetStat("almost-expired-exceptions", []() { return getAlmostExpiredTaskExceptions(); }); + /* make sure that the ECS stats are properly initialized */ SyncRes::clearECSStats(); for (size_t idx = 0; idx < SyncRes::s_ecsResponsesBySubnetSize4.size(); idx++) { diff --git a/pdns/recursordist/Makefile.am b/pdns/recursordist/Makefile.am index 80939a72f9..e9b9b43a4a 100644 --- a/pdns/recursordist/Makefile.am +++ b/pdns/recursordist/Makefile.am @@ -183,7 +183,7 @@ pdns_recursor_SOURCES = \ sortlist.cc sortlist.hh \ sstuff.hh \ stable-bloom.hh \ - stats_t.hh \ + stat_t.hh \ svc-records.cc svc-records.hh \ syncres.cc syncres.hh \ taskqueue.cc taskqueue.hh \ diff --git a/pdns/recursordist/RECURSOR-MIB.txt b/pdns/recursordist/RECURSOR-MIB.txt index cd21321fd4..b2478d7bfe 100644 --- a/pdns/recursordist/RECURSOR-MIB.txt +++ b/pdns/recursordist/RECURSOR-MIB.txt @@ -15,7 +15,7 @@ IMPORTS FROM SNMPv2-CONF; rec MODULE-IDENTITY - LAST-UPDATED "202002170000Z" + LAST-UPDATED "202107200000Z" ORGANIZATION "PowerDNS BV" CONTACT-INFO "support@powerdns.com" DESCRIPTION @@ -36,6 +36,9 @@ rec MODULE-IDENTITY REVISION "202101050000Z" DESCRIPTION "Added Aggressive NSEC cache metrics." + REVISION "202107200000Z" + DESCRIPTION "Added almost expired task metrics." + ::= { powerdns 2 } powerdns OBJECT IDENTIFIER ::= { enterprises 43315 } @@ -954,6 +957,30 @@ dns64PrefixAnswers OBJECT-TYPE "Number of answers generated by dns64-prefix matching" ::= { stats 114 } +almostExpiredPushed OBJECT-TYPE + SYNTAX Counter64 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of almost-expired tasks pushed" + ::= { stats 115 } + +almostExpiredRun OBJECT-TYPE + SYNTAX Counter64 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of almost-expired tasks run" + ::= { stats 116 } + +almostExpiredExceptions OBJECT-TYPE + SYNTAX Counter64 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of almost-expired tasks that caused an exception" + ::= { stats 117 } + --- --- Traps / Notifications --- diff --git a/pdns/recursordist/docs/metrics.rst b/pdns/recursordist/docs/metrics.rst index d1c2c27a10..4f4a29f9b6 100644 --- a/pdns/recursordist/docs/metrics.rst +++ b/pdns/recursordist/docs/metrics.rst @@ -126,6 +126,24 @@ It should be noted that answers0-1 + answers1-10 + answers10-100 + answers100-10 Also note that unauthorized-tcp and unauthorized-udp packets do not end up in the 'questions' count. +almost-expired-pushed +^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 4.6 + +number of almost-expired tasks pushed + +almost-expired-run +^^^^^^^^^^^^^^^^^^ +.. versionadded:: 4.6 + +number of almost-expired tasks run + +almost-expired-exceptions +^^^^^^^^^^^^^^^^^^^^^^^^^ +.. versionadded:: 4.6 + +number of almost-expired tasks that caused an exception + aggressive-nsec-cache-entries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. versionadded:: 4.5 diff --git a/pdns/recursordist/rec-taskqueue.cc b/pdns/recursordist/rec-taskqueue.cc index 21404ad13b..9bd0cd6c3b 100644 --- a/pdns/recursordist/rec-taskqueue.cc +++ b/pdns/recursordist/rec-taskqueue.cc @@ -30,7 +30,7 @@ static pdns::stat_t s_almost_expired_tasks_pushed; static pdns::stat_t s_almost_expired_tasks_run; static pdns::stat_t s_almost_expired_tasks_exceptions; -static void resolve(const struct timeval &now, bool logErrors, const pdns::ResolveTask& task) +static void resolve(const struct timeval& now, bool logErrors, const pdns::ResolveTask& task) { ++s_almost_expired_tasks_run; const string msg = "Exception while running a background ResolveTask"; @@ -108,4 +108,3 @@ uint64_t getAlmostExpiredTaskExceptions() { return s_almost_expired_tasks_exceptions; } - diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index 2a4b39c51a..44e768b532 100644 --- a/pdns/ws-recursor.cc +++ b/pdns/ws-recursor.cc @@ -1050,6 +1050,18 @@ const std::map MetricDefinitionStorage::metrics = { "cumul-auth6answers-count", MetricDefinition(PrometheusMetricType::histogram, "histogram of authoritative answer times over IPV6")}, + + { "almost-expired-pushed", + MetricDefinition(PrometheusMetricType::counter, + "number of almost-expired tasks pushed")}, + + { "almost-expired-run", + MetricDefinition(PrometheusMetricType::counter, + "number of almost-expired tasks run")}, + + { "almost-expired-exceptions", + MetricDefinition(PrometheusMetricType::counter, + "number of almost-expired tasks that caused an exception")}, }; #define CHECK_PROMETHEUS_METRICS 0