diff util/startup.lua @ 13981:350e16e5f9aa

net.unbound: Count number of DNS response records In order to gather stats on how wide-spread various record types are, and how many records per rrset are common.
author Kim Alvefur <zash@zash.se>
date Tue, 07 Oct 2025 23:50:12 +0200
parents d8c001271669
children ccbc4a46f42d
line wrap: on
line diff
--- a/util/startup.lua	Tue Oct 07 19:09:25 2025 +0200
+++ b/util/startup.lua	Tue Oct 07 23:50:12 2025 +0200
@@ -449,7 +449,11 @@
 		local m = statsmanager.metric("histogram", "prosody_dns", "seconds", "DNS lookups", { "qclass"; "qtype" }, {
 				buckets = { 1 / 1024; 1 / 256; 1 / 64; 1 / 16; 1 / 4; 1; 4 };
 		});
-		adns.instrument(function(qclass, qtype) return timed(m:with_labels(qclass, qtype)); end);
+		local c = statsmanager.metric("histogram", "prosody_dns_response", "records", "DNS response records", { "qclass"; "qtype" }, {
+			buckets = { 1; 2; 4; 8; 16 } })
+		local function m_times(qclass, qtype) return timed(m:with_labels(qclass, qtype)); end
+		local function m_counts(qclass, qtype, num) return c:with_labels(qclass, qtype):add(num); end
+		adns.instrument(m_times, m_counts);
 	end
 end