Diff

core/statsmanager.lua @ 11200:bf8f2da84007

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 05 Nov 2020 22:31:25 +0100
parent 10884:6992c4be1a19
child 11506:9a3ebdd65f9c
line wrap: on
line diff
--- a/core/statsmanager.lua	Thu Nov 05 22:27:17 2020 +0100
+++ b/core/statsmanager.lua	Thu Nov 05 22:31:25 2020 +0100
@@ -60,9 +60,9 @@
 local stats_extra = {};
 
 if stats then
-	function measure(type, name)
+	function measure(type, name, conf)
 		local f = assert(stats[type], "unknown stat type: "..type);
-		return f(name);
+		return f(name, conf);
 	end
 
 	if stats_interval then
@@ -79,6 +79,7 @@
 			if stats.get_stats then
 				changed_stats, stats_extra = {}, {};
 				for stat_name, getter in pairs(stats.get_stats()) do
+					-- luacheck: ignore 211/type
 					local type, value, extra = getter();
 					local old_value = latest_stats[stat_name];
 					latest_stats[stat_name] = value;
@@ -97,6 +98,7 @@
 		end
 		timer.add_task(stats_interval, collect);
 		prosody.events.add_handler("server-started", function () collect() end, -1);
+		prosody.events.add_handler("server-stopped", function () collect() end, -1);
 	else
 		log("debug", "Statistics enabled using %s provider, collection is disabled", stats_provider_name);
 	end