diff options
Diffstat (limited to 'core/statsmanager.lua')
-rw-r--r-- | core/statsmanager.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/statsmanager.lua b/core/statsmanager.lua index 237b1dd5..1f958194 100644 --- a/core/statsmanager.lua +++ b/core/statsmanager.lua @@ -60,9 +60,9 @@ local changed_stats = {}; 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 @@ -77,8 +77,10 @@ if stats then mark_collection_done(); if stats.get_stats then + local mark_processing_done = mark_processing_start(); 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; @@ -89,7 +91,6 @@ if stats then stats_extra[stat_name] = extra; end end - local mark_processing_done = mark_processing_start(); fire_event("stats-updated", { stats = latest_stats, changed_stats = changed_stats, stats_extra = stats_extra }); mark_processing_done(); end @@ -97,6 +98,7 @@ if stats then 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 |