diff options
author | Matthew Wild <mwild1@gmail.com> | 2024-12-28 18:35:24 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2024-12-28 18:35:24 +0000 |
commit | f45d88d61425e96c115af44f867626aac664cbf8 (patch) | |
tree | d3e8f32ad4a6a533aaf8e03eccdcd71fa7009faa /plugins | |
parent | a2b2d01c3e5c84da11a675b3848c5d28d7c919fa (diff) | |
download | prosody-f45d88d61425e96c115af44f867626aac664cbf8.tar.gz prosody-f45d88d61425e96c115af44f867626aac664cbf8.zip |
mod_admin_shell: stats:show(): Friendlier error message when statistics disabledHEADorigin/mastermaster
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_admin_shell.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/mod_admin_shell.lua b/plugins/mod_admin_shell.lua index 0b8d3c43..c32048c3 100644 --- a/plugins/mod_admin_shell.lua +++ b/plugins/mod_admin_shell.lua @@ -2431,12 +2431,15 @@ describe_command [[stats:show(pattern) - Show internal statistics, optionally fi -- Undocumented currently, you can append :histogram() or :cfgraph() to stats:show() for rendered graphs. function def_env.stats:show(name_filter) local statsman = require "prosody.core.statsmanager" + local metric_registry = statsman.get_metric_registry(); + if not metric_registry then + return nil, [[Statistics disabled. Try `statistics = "internal"` in the global section of the config file and restart.]]; + end local collect = statsman.collect if collect then -- force collection if in manual mode collect() end - local metric_registry = statsman.get_metric_registry(); local displayed_stats = new_stats_context(self); for family_name, metric_family in iterators.sorted_pairs(metric_registry:get_metric_families()) do if not name_filter or family_name:match(name_filter) then |