aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_http_file_share.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-03-28 13:15:11 +0200
committerKim Alvefur <zash@zash.se>2021-03-28 13:15:11 +0200
commit9631d45fcc26b772b86ddf756608dd7ac2cf4a57 (patch)
treeb746e466af1ccb4ad2edca6644df90cce7d76c66 /plugins/mod_http_file_share.lua
parent7bd27186017848de0853d25a08fc6a36c59e6e66 (diff)
downloadprosody-9631d45fcc26b772b86ddf756608dd7ac2cf4a57.tar.gz
prosody-9631d45fcc26b772b86ddf756608dd7ac2cf4a57.zip
mod_http_file_share: Report number of items in caches to statsmanager
This is neat, O(1) reporting, why don't we do this everywhere? Gives you an idea of how much stuff is in the caches, which may help inform decisions on whether the size is appropriate.
Diffstat (limited to 'plugins/mod_http_file_share.lua')
-rw-r--r--plugins/mod_http_file_share.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua
index 94b84867..2191cb30 100644
--- a/plugins/mod_http_file_share.lua
+++ b/plugins/mod_http_file_share.lua
@@ -62,6 +62,14 @@ local upload_errors = errors.init(module.name, namespace, {
local upload_cache = cache.new(1024);
local quota_cache = cache.new(1024);
+local measure_upload_cache_size = module:measure("upload_cache", "amount");
+local measure_quota_cache_size = module:measure("quota_cache", "amount");
+
+module:hook_global("stats-update", function ()
+ measure_upload_cache_size(upload_cache:count());
+ measure_quota_cache_size(quota_cache:count());
+end);
+
local measure_uploads = module:measure("upload", "sizes");
-- Convenience wrapper for logging file sizes