# HG changeset patch # User Emmanuel Gil Peyrot # Date 1529658542 -7200 # Node ID fdbf7c2aed7b5f3935b17a99794bf1df4c9048ca # Parent e166ccc7a77921c5b0acd77529dc09593705d847 mod_measure_client_identities: Report 0 instead of the previous value when no client with that identity is left. diff -r e166ccc7a779 -r fdbf7c2aed7b mod_measure_client_identities/mod_measure_client_identities.lua --- 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)