aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-09-12 17:03:02 +0200
committerKim Alvefur <zash@zash.se>2021-09-12 17:03:02 +0200
commit9af7bb723b3964a1884d98bf67bcb86ef19ccf60 (patch)
tree752058400c9e2000e5d85e8826d4457f317298f4
parentdb40eba6557868498685e86216c7dd12294b3434 (diff)
downloadprosody-9af7bb723b3964a1884d98bf67bcb86ef19ccf60.tar.gz
prosody-9af7bb723b3964a1884d98bf67bcb86ef19ccf60.zip
mod_http_file_share: Measure current total usage
In order to allow monitoring. Especially as there's not much in the way of hard numbers on how much space gets used.
-rw-r--r--plugins/mod_http_file_share.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_http_file_share.lua b/plugins/mod_http_file_share.lua
index c18187cd..ddcc6c71 100644
--- a/plugins/mod_http_file_share.lua
+++ b/plugins/mod_http_file_share.lua
@@ -70,10 +70,17 @@ local total_storage_usage = nil;
local measure_upload_cache_size = module:measure("upload_cache", "amount");
local measure_quota_cache_size = module:measure("quota_cache", "amount");
+local measure_total_storage_usage = nil;
+if total_storage_limit then
+ measure_total_storage_usage = module:measure("total_storage", "amount", { unit = "bytes" });
+end
module:hook_global("stats-update", function ()
measure_upload_cache_size(upload_cache:count());
measure_quota_cache_size(quota_cache:count());
+ if total_storage_limit then
+ measure_total_storage_usage(total_storage_usage);
+ end
end);
local buckets = {};