diff util/startup.lua @ 13982:ccbc4a46f42d

util.startup: Fix error in DNS instrumentation > attempt to call a nil value (method 'add')
author Kim Alvefur <zash@zash.se>
date Thu, 09 Oct 2025 13:45:52 +0200
parents 350e16e5f9aa
children 260a6feebe5f
line wrap: on
line diff
--- a/util/startup.lua	Tue Oct 07 23:50:12 2025 +0200
+++ b/util/startup.lua	Thu Oct 09 13:45:52 2025 +0200
@@ -452,7 +452,7 @@
 		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
+		local function m_counts(qclass, qtype, num) return c:with_labels(qclass, qtype):sample(num); end
 		adns.instrument(m_times, m_counts);
 	end
 end