Mercurial > prosody-hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 13980:d8c001271669 | 13981:350e16e5f9aa |
|---|---|
| 447 local adns = require "prosody.net.adns"; | 447 local adns = require "prosody.net.adns"; |
| 448 if adns.instrument then | 448 if adns.instrument then |
| 449 local m = statsmanager.metric("histogram", "prosody_dns", "seconds", "DNS lookups", { "qclass"; "qtype" }, { | 449 local m = statsmanager.metric("histogram", "prosody_dns", "seconds", "DNS lookups", { "qclass"; "qtype" }, { |
| 450 buckets = { 1 / 1024; 1 / 256; 1 / 64; 1 / 16; 1 / 4; 1; 4 }; | 450 buckets = { 1 / 1024; 1 / 256; 1 / 64; 1 / 16; 1 / 4; 1; 4 }; |
| 451 }); | 451 }); |
| 452 adns.instrument(function(qclass, qtype) return timed(m:with_labels(qclass, qtype)); end); | 452 local c = statsmanager.metric("histogram", "prosody_dns_response", "records", "DNS response records", { "qclass"; "qtype" }, { |
| 453 buckets = { 1; 2; 4; 8; 16 } }) | |
| 454 local function m_times(qclass, qtype) return timed(m:with_labels(qclass, qtype)); end | |
| 455 local function m_counts(qclass, qtype, num) return c:with_labels(qclass, qtype):add(num); end | |
| 456 adns.instrument(m_times, m_counts); | |
| 453 end | 457 end |
| 454 end | 458 end |
| 455 | 459 |
| 456 function startup.init_data_store() | 460 function startup.init_data_store() |
| 457 require "prosody.core.storagemanager"; | 461 require "prosody.core.storagemanager"; |
