]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Expose almost-expired metrics
authorOtto <otto.moerbeek@open-xchange.com>
Tue, 20 Jul 2021 08:47:51 +0000 (10:47 +0200)
committerOtto <otto.moerbeek@open-xchange.com>
Tue, 17 Aug 2021 10:12:05 +0000 (12:12 +0200)
pdns/rec-snmp.cc
pdns/rec_channel_rec.cc
pdns/recursordist/Makefile.am
pdns/recursordist/RECURSOR-MIB.txt
pdns/recursordist/docs/metrics.rst
pdns/recursordist/rec-taskqueue.cc
pdns/ws-recursor.cc

index 745b48f1455baa9a1472545126304fbf279ba4b0..a63dd78c967324dcfe876aaed8b78b6e7652cd0b 100644 (file)
@@ -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<oid, std::string> 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 */
 }
index 17dff3c1556e2c95ebc177ba400109bb333cc15e..0c8928836ff952a117781f4e21e1019c64968917 100644 (file)
@@ -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++) {
index 80939a72f94f03d8f37c48af1e64fee816ec46b0..e9b9b43a4ae89e6fd3e3816fc4bdc762ec204819 100644 (file)
@@ -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 \
index cd21321fd4c065ef39b672891c9d672fe6f9bf15..b2478d7bfed80a483d5f99f061a8e1feba468521 100644 (file)
@@ -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
 ---
index d1c2c27a108489426b3647af6aaff82dfc01c669..4f4a29f9b606942e0a314ef6dc70dbe93a3ab427 100644 (file)
@@ -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
index 21404ad13b987497f42a1c424f6e3bf76abbd01a..9bd0cd6c3b304cff80624b3e99844ac4aa052aac 100644 (file)
@@ -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 timevalnow, 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;
 }
-
index 2a4b39c51a6431c66aee86ecebcbae0690e5ae1d..44e768b532b84f481e0cc3688ccc54baa7bb0750 100644 (file)
@@ -1050,6 +1050,18 @@ const std::map<std::string, MetricDefinition> 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