From: Otto Moerbeek Date: Wed, 28 May 2025 11:43:02 +0000 (+0200) Subject: Implement metrics X-Git-Tag: rec-5.1.6^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=736be2dd19aedb3bedaf77a20c2395a74ad03055;p=thirdparty%2Fpdns.git Implement metrics --- diff --git a/pdns/recursordist/RECURSOR-MIB.txt b/pdns/recursordist/RECURSOR-MIB.txt index 01b8d6f565..62537e7a41 100644 --- a/pdns/recursordist/RECURSOR-MIB.txt +++ b/pdns/recursordist/RECURSOR-MIB.txt @@ -21,50 +21,8 @@ rec MODULE-IDENTITY DESCRIPTION "This MIB module describes information gathered through PowerDNS Recursor." - REVISION "202505270000Z" - DESCRIPTION "Added metric for missing ECS in reply" - - REVISION "202408280000Z" - DESCRIPTION "Added metric for too many incoming TCP connections" - - REVISION "202408130000Z" - DESCRIPTION "Added metric for chain limits reached" - - REVISION "202405230000Z" - DESCRIPTION "Added metrics for maximum chain length and weight" - - REVISION "202306080000Z" - DESCRIPTION "Added metrics for NOD and UDR events" - - REVISION "202302240000Z" - DESCRIPTION "Added metrics for sharded packet cache contention" - - REVISION "202209120000Z" - DESCRIPTION "Added metrics for answers from auths by rcode" - - REVISION "202208220000Z" - DESCRIPTION "Added internal maintenance metrics." - - REVISION "202201310000Z" - DESCRIPTION "Added non-resolving NS name metric." - - REVISION "202111090000Z" - DESCRIPTION "Added NOTIFY-related metrics." - - REVISION "202110270000Z" - DESCRIPTION "Added more UDP errors metric." - - REVISION "202107200000Z" - DESCRIPTION "Added almost expired task metrics." - - REVISION "202101050000Z" - DESCRIPTION "Added Aggressive NSEC cache metrics." - - REVISION "202002170000Z" - DESCRIPTION "Added proxyProtocolInvalid metric." - - REVISION "201911140000Z" - DESCRIPTION "Added qnameMinFallbackSuccess stats." + REVISION "201611290000Z" + DESCRIPTION "Initial revision." REVISION "201812240000Z" DESCRIPTION "Added the dnssecAuthenticDataQueries and dnssecCheckDisabledQueries stats." @@ -1536,13 +1494,9 @@ recGroup OBJECT-GROUP udrEvents, maxChainLength, maxChainWeight, -<<<<<<< HEAD - chainLimits -======= chainLimits, tcpOverflow, ecsMissing ->>>>>>> 36edbdb8b (Add setting and metric) } STATUS current DESCRIPTION "Objects conformance group for PowerDNS Recursor" diff --git a/pdns/recursordist/rec-snmp.cc b/pdns/recursordist/rec-snmp.cc index f6e91ec455..de675281e0 100644 --- a/pdns/recursordist/rec-snmp.cc +++ b/pdns/recursordist/rec-snmp.cc @@ -206,6 +206,8 @@ static const oid10 udrEventsOID = {RECURSOR_STATS_OID, 148}; static const oid10 maxChainLengthOID = {RECURSOR_STATS_OID, 149}; static const oid10 maxChainWeightOID = {RECURSOR_STATS_OID, 150}; static const oid10 chainLimitsOID = {RECURSOR_STATS_OID, 151}; +static const oid10 tcpOverflowOID = {RECURSOR_STATS_OID, 152}; +static const oid10 ecsMissingOID = {RECURSOR_STATS_OID, 153}; static std::unordered_map s_statsMap; @@ -462,6 +464,8 @@ RecursorSNMPAgent::RecursorSNMPAgent(const std::string& name, const std::string& registerCounter64Stat("udr-events", udrEventsOID); registerCounter64Stat("max-chain-length", maxChainLengthOID); registerCounter64Stat("max-chain-weight", maxChainWeightOID); + registerCounter64Stat("tcp-overflow", tcpOverflowOID); + registerCounter64Stat("ecs-missing", ecsMissingOID); #endif /* HAVE_NET_SNMP */ } diff --git a/pdns/recursordist/rec_channel_rec.cc b/pdns/recursordist/rec_channel_rec.cc index b46fed7684..efcf432886 100644 --- a/pdns/recursordist/rec_channel_rec.cc +++ b/pdns/recursordist/rec_channel_rec.cc @@ -1569,6 +1569,7 @@ static void registerAllStats1() addGetStat("max-chain-length", [] { return g_Counters.max(rec::Counter::maxChainLength); }); addGetStat("max-chain-weight", [] { return g_Counters.max(rec::Counter::maxChainWeight); }); addGetStat("chain-limits", [] { return g_Counters.sum(rec::Counter::chainLimits); }); + addGetStat("ecs-missing", [] { return g_Counters.sum(rec::Counter::ecsMissingCount); }); /* make sure that the ECS stats are properly initialized */ SyncRes::clearECSStats(); diff --git a/pdns/recursordist/ws-recursor.cc b/pdns/recursordist/ws-recursor.cc index c2a745ac2d..40847c2632 100644 --- a/pdns/recursordist/ws-recursor.cc +++ b/pdns/recursordist/ws-recursor.cc @@ -1261,6 +1261,10 @@ const std::map MetricDefinitionStorage::d_metrics {"chain-limits", MetricDefinition(PrometheusMetricType::counter, "Chain limits reached")}, + + {"ecs-missing", + MetricDefinition(PrometheusMetricType::counter, + "Number of answers where ECS info was missing")}, }; constexpr bool CHECK_PROMETHEUS_METRICS = false;