aboutsummaryrefslogtreecommitdiffstats
path: root/util/statistics.lua
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2019-10-10 16:58:02 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2019-10-10 16:58:02 +0200
commitfe0ae623c79dea7d567e7328b287396deed7d429 (patch)
tree9a35db90009b3e6a4e3c3e6913645a75fa6d81c1 /util/statistics.lua
parentf7a939d9a77537c10c260285cc3b5238a60deace (diff)
downloadprosody-fe0ae623c79dea7d567e7328b287396deed7d429.tar.gz
prosody-fe0ae623c79dea7d567e7328b287396deed7d429.zip
util.statistics: Add a total count for rate counters, counting from server start.
Diffstat (limited to 'util/statistics.lua')
-rw-r--r--util/statistics.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/statistics.lua b/util/statistics.lua
index 39954652..0ec88e21 100644
--- a/util/statistics.lua
+++ b/util/statistics.lua
@@ -57,12 +57,14 @@ local function new_registry(config)
end;
end;
rate = function (name)
- local since, n = time(), 0;
+ local since, n, total = time(), 0, 0;
registry[name..":rate"] = function ()
+ total = total + n;
local t = time();
local stats = {
rate = n/(t-since);
count = n;
+ total = total;
};
since, n = t, 0;
return "rate", stats.rate, stats;