From 4394dbf275eb840fe8f4568eca3957560c42c3d0 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Thu, 10 Oct 2019 16:58:02 +0200 Subject: util.statistics: Add a total count for rate counters, counting from server start. --- util/statistics.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3