Software /
code /
prosody-modules
Comparison
mod_measure_client_identities/mod_measure_client_identities.lua @ 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 |
parent | 3135:e166ccc7a779 |
comparison
equal
deleted
inserted
replaced
3135:e166ccc7a779 | 3136:fdbf7c2aed7b |
---|---|
20 buckets[node] = buckets[node] + 1; | 20 buckets[node] = buckets[node] + 1; |
21 else | 21 else |
22 buckets.unknown = buckets.unknown + 1; | 22 buckets.unknown = buckets.unknown + 1; |
23 end | 23 end |
24 end | 24 end |
25 local visited = {}; | |
25 for bucket, count in pairs(buckets) do | 26 for bucket, count in pairs(buckets) do |
26 if counters[bucket] == nil then | 27 if counters[bucket] == nil then |
27 counters[bucket] = measure("amount", "client_identities."..bucket); | 28 counters[bucket] = measure("amount", "client_identities."..bucket); |
28 end | 29 end |
29 counters[bucket](count); | 30 counters[bucket](count); |
31 visited[bucket] = true; | |
32 end | |
33 for bucket, counter in pairs(counters) do | |
34 if not visited[bucket] then | |
35 counter(0); | |
36 end | |
30 end | 37 end |
31 end) | 38 end) |