]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Add dns64 metrics 10546/head
authorOtto <otto.moerbeek@open-xchange.com>
Tue, 29 Jun 2021 13:00:46 +0000 (15:00 +0200)
committerOtto <otto.moerbeek@open-xchange.com>
Wed, 30 Jun 2021 13:49:53 +0000 (15:49 +0200)
pdns/pdns_recursor.cc
pdns/rec-snmp.cc
pdns/rec_channel_rec.cc
pdns/recursordist/RECURSOR-MIB.txt
pdns/recursordist/docs/metrics.rst
pdns/recursordist/docs/settings.rst
pdns/syncres.hh
pdns/ws-recursor.cc

index f1204784ddf1b534f873dc6fb1bd9ee9d3bb5272..44020ec4dd526369b8a35c244e0e9ef1389ee511 100644 (file)
@@ -1520,6 +1520,7 @@ int getFakeAAAARecords(const DNSName& qname, ComboAddress prefix, vector<DNSReco
           }),
         ret.end());
   }
+  g_stats.dns64prefixanswers++;
   return rcode;
 }
 
@@ -1550,6 +1551,7 @@ int getFakePTRRecords(const DNSName& qname, vector<DNSRecord>& ret)
 
   int rcode = directResolve(DNSName(newquery), QType::PTR, QClass::IN, ret);
 
+  g_stats.dns64prefixanswers++;
   return rcode;
 }
 
index cc6b5541aac15c56dc4a1cc55cca551b78506ac1..745b48f1455baa9a1472545126304fbf279ba4b0 100644 (file)
@@ -131,6 +131,7 @@ static const oid aggressiveNSECCacheNSEC3HitsOID[] = { RECURSOR_STATS_OID, 110 }
 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 std::unordered_map<oid, std::string> s_statsMap;
 
@@ -353,5 +354,6 @@ RecursorSNMPAgent::RecursorSNMPAgent(const std::string& name, const std::string&
   registerCounter64Stat("aggressive-nsec-cache-nsec-wc-hits", aggressiveNSECCacheNSECWCHitsOID, OID_LENGTH(aggressiveNSECCacheNSECWCHitsOID));
   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));
 #endif /* HAVE_NET_SNMP */
 }
index e1eb007f582c6236fdc4c626520dcba05a14ee4e..9234b412aece3d882656b9ffed3516a127901b7b 100644 (file)
@@ -1364,6 +1364,8 @@ static void registerAllStats1()
   addGetStat("taskqueue-expired",  []() { return getTaskExpired(); });
   addGetStat("taskqueue-size",  []() { return getTaskSize(); });
 
+  addGetStat("dns64-prefix-answers",  &g_stats.dns64prefixanswers);
+
   /* make sure that the ECS stats are properly initialized */
   SyncRes::clearECSStats();
   for (size_t idx = 0; idx < SyncRes::s_ecsResponsesBySubnetSize4.size(); idx++) {
index cc7ad62b84e8002d540badfc6beb8f8bef4360f8..749e19311261d658bafb595f1e268ca2ba2e83d1 100644 (file)
@@ -946,6 +946,14 @@ dotOutqueries OBJECT-TYPE
         "Number of outgoing DoT queries since starting"
     ::= { stats 113 }
 
+dns64PrefixAnswers OBJECT-TYPE
+    SYNTAX Counter64
+    MAX-ACCESS read-only
+    STATUS current
+    DESCRIPTION
+        "Number of answers generated by dns64-prefix matching"
+    ::= { stats 114 }
+
 ---
 --- Traps / Notifications
 ---
@@ -1102,7 +1110,8 @@ recGroup OBJECT-GROUP
         aggressiveNSECCacheNSEC3Hits,
         aggressiveNSECCacheNSECWcHits,
         aggressiveNSECCacheNSEC3WcHits,
-        dotOutqueries
+        dotOutqueries,
+        dns64PrefixAnswers
     }
     STATUS current
     DESCRIPTION "Objects conformance group for PowerDNS Recursor"
index aec71dc44e9df4c27bdddad74f0e9c7e73b4a100..d1c2c27a108489426b3647af6aaff82dfc01c669 100644 (file)
@@ -268,6 +268,8 @@ Stolen time, which is the time spent by the whole system in other operating syst
 
 cumul-answers-x
 ^^^^^^^^^^^^^^^^^^
+.. versionadded:: 4.6
+
 Cumulative counts of answer times in buckets less or equal than x microseconds.
 These metrics include packet cache hits.
 These metrics are useful for Prometheus and not listed other outputs by default.
@@ -275,14 +277,23 @@ These metrics are useful for Prometheus and not listed other outputs by default.
 
 cumul-auth4-answers-x
 ^^^^^^^^^^^^^^^^^^^^^
+.. versionadded:: 4.6
+
 Cumulative counts of answer times of authoritative servers over IPv4 in buckets less than x microseconds.
 These metrics are useful for Prometheus and not listed other outputs by default.
 
 cumul-auth6-answers-x
 ^^^^^^^^^^^^^^^^^^^^^
+.. versionadded:: 4.6
+
 Cumulative counts of answer times of authoritative servers over IPv6 in buckets less than x microseconds.
 These metrics are useful for Prometheus and not listed other outputs by default.
 
+dns64-prefix-answers
+^^^^^^^^^^^^^^^^^^^^
+.. versionadded:: 4.6
+
+number of ``AAAA`` and ``PTR`` answers generated by :ref:`setting-dns64-prefix` matching.
 
 dnssec-authentic-data-queries
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
index 75d73b83e8a0f8c7c782e2f06496ee83b747b205..10a7b37747fda8e5d010029105385d0ab29f342f 100644 (file)
@@ -389,7 +389,7 @@ ratio.
 .. _settings-dot-to-auth-names:
 
 ``dot-to-auth-names``
--------------------
+---------------------
 .. versionadded:: 4.6.0
 
 - Comma separated list of domain-names or suffixes
@@ -418,8 +418,8 @@ Enable DoT to forwarders that specify port 853.
 -  Netmask, as a string
 -  Default: None
 
-Enable DNS64 (:rfc:`6147`) support using the supplied /96 IPv6 prefix. This will generate 'fake' AAAA records for names
-with only `A` records, as well as 'fake' PTR records to make sure that reverse lookup of DNS64-generated IPv6 addresses
+Enable DNS64 (:rfc:`6147`) support using the supplied /96 IPv6 prefix. This will generate 'fake' ``AAAA`` records for names
+with only ``A`` records, as well as 'fake' ``PTR`` records to make sure that reverse lookup of DNS64-generated IPv6 addresses
 generate the right name.
 See :doc:`dns64` for more flexible but slower alternatives using Lua.
 
index 9396c315a16862bcb2121bf96b3cf7439db07a48..4b91cfe8143d55b52e843154536fcfcc31915ad8 100644 (file)
@@ -1052,6 +1052,7 @@ struct RecursorStats
   std::atomic<uint64_t> rebalancedQueries{0};
   std::atomic<uint64_t> proxyProtocolInvalidCount{0};
   std::atomic<uint64_t> nodLookupsDroppedOversize{0};
+  std::atomic<uint64_t> dns64prefixanswers{0};
 
   RecursorStats() :
     answers("answers", { 1000, 10000, 100000, 1000000 }),
index 56f9722dc55d86d48ef8ea9c3d6552dd57428de1..c73aca44ced56b1b6b4c70ae3e61ef1d0b3b1ce8 100644 (file)
@@ -1034,6 +1034,10 @@ const std::map<std::string, MetricDefinition> MetricDefinitionStorage::metrics =
     MetricDefinition(PrometheusMetricType::counter,
                      "Number of outgoing DoT queries since starting")},
 
+  { "dns64-prefix-answers",
+    MetricDefinition(PrometheusMetricType::counter,
+                     "Number of AAAA and PTR generated by a matching dns64-prefix")},
+
   // For cumulative histogram, state the xxx_count name where xxx matches the name in rec_channel_rec
   { "cumul-answers-count",
     MetricDefinition(PrometheusMetricType::histogram,