Mercurial > prosody-modules
view mod_measure_pending_s2s/mod_measure_pending_s2s.lua @ 6562:5da6fb562df9 default tip
mod_unified_push: Fix push error handling (fixes #2000)
Use the error object that send_iq() passes
as an argument to it's reject callback instead of attempting
and failing to do the parsing in the callback itself.
| author | kmq |
|---|---|
| date | Mon, 06 Jul 2026 14:23:57 +0200 |
| parents | 4c98f4340bf1 |
| children |
line wrap: on
line source
module:set_global(); local measure_pending_connections = module:metric( "gauge", "connections_pending_outbound", "", "In-progress outbound s2s connections", {"host"} ); local measure_pending_stanzas = module:metric( "gauge", "stanzas_pending_outbound", "", "Outbound s2s stanzas queued for delivery", {"host"} ); local hosts = {}; function module.add_host(host_module) hosts[host_module.host] = true; function host_module.unload() hosts[host_module.host] = nil; end end module:hook("stats-update", function () for host in pairs(hosts) do local n_pending_sessions = 0; local n_pending_stanzas = 0; for _, session in pairs(prosody.hosts[host].s2sout) do if session.sendq then n_pending_sessions = n_pending_sessions + 1; n_pending_stanzas = n_pending_stanzas + session.sendq:count(); end end measure_pending_connections:with_labels(host):set(n_pending_sessions); measure_pending_stanzas:with_labels(host):set(n_pending_stanzas); end end);
