Mercurial > prosody-hg
diff net/unbound.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 | 5abdcad8c2e0 |
| children | 41fa97090264 |
line wrap: on
line diff
--- a/net/unbound.lua Tue Oct 07 19:09:25 2025 +0200 +++ b/net/unbound.lua Tue Oct 07 23:50:12 2025 +0200 @@ -119,6 +119,8 @@ return measure; end +local count = measure; + local function lookup(callback, qname, qtype, qclass) if not unbound then initialize(); end qtype = qtype and s_upper(qtype) or "A"; @@ -132,6 +134,7 @@ m(); waiting_queries[ret] = nil; if a then + count(qclass, qtype, #a); prep_answer(a); log_query("debug", "Results for %s %s %s: %s (%s)", qname, qclass, qtype, a.rcode == 0 and (#a .. " items") or a.status, a.secure and "Secure" or a.bogus or "Insecure"); -- Insecure as in unsigned @@ -230,7 +233,7 @@ }; } -_M.instrument = function(measure_) measure = measure_; end; +_M.instrument = function(measure_, count_) measure, count = measure_, count_; end; function _M.resolver() return wrapper; end
