Mercurial > prosody-modules
changeset 3136:fdbf7c2aed7b
mod_measure_client_identities: Report 0 instead of the previous value when no client with that identity is left.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 22 Jun 2018 11:09:02 +0200 (2018-06-22) |
parents | e166ccc7a779 |
children | 178ebea5097c |
files | mod_measure_client_identities/mod_measure_client_identities.lua |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_measure_client_identities/mod_measure_client_identities.lua Fri Jun 22 01:06:18 2018 +0200 +++ b/mod_measure_client_identities/mod_measure_client_identities.lua Fri Jun 22 11:09:02 2018 +0200 @@ -22,10 +22,17 @@ buckets.unknown = buckets.unknown + 1; end end + local visited = {}; for bucket, count in pairs(buckets) do if counters[bucket] == nil then counters[bucket] = measure("amount", "client_identities."..bucket); end counters[bucket](count); + visited[bucket] = true; + end + for bucket, counter in pairs(counters) do + if not visited[bucket] then + counter(0); + end end end)