Software /
code /
prosody
Comparison
plugins/mod_http_file_share.lua @ 11794:5d925f340ae6
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 12 Sep 2021 17:03:02 +0200 |
parent | 11784:f0971a9eba88 |
child | 11802:3d411720e719 |
comparison
equal
deleted
inserted
replaced
11793:9006ff4838ff | 11794:5d925f340ae6 |
---|---|
68 | 68 |
69 local total_storage_usage = nil; | 69 local total_storage_usage = nil; |
70 | 70 |
71 local measure_upload_cache_size = module:measure("upload_cache", "amount"); | 71 local measure_upload_cache_size = module:measure("upload_cache", "amount"); |
72 local measure_quota_cache_size = module:measure("quota_cache", "amount"); | 72 local measure_quota_cache_size = module:measure("quota_cache", "amount"); |
73 local measure_total_storage_usage = nil; | |
74 if total_storage_limit then | |
75 measure_total_storage_usage = module:measure("total_storage", "amount", { unit = "bytes" }); | |
76 end | |
73 | 77 |
74 module:hook_global("stats-update", function () | 78 module:hook_global("stats-update", function () |
75 measure_upload_cache_size(upload_cache:count()); | 79 measure_upload_cache_size(upload_cache:count()); |
76 measure_quota_cache_size(quota_cache:count()); | 80 measure_quota_cache_size(quota_cache:count()); |
81 if total_storage_limit then | |
82 measure_total_storage_usage(total_storage_usage); | |
83 end | |
77 end); | 84 end); |
78 | 85 |
79 local buckets = {}; | 86 local buckets = {}; |
80 for n = 10, 40, 2 do | 87 for n = 10, 40, 2 do |
81 local exp = math.floor(2 ^ n); | 88 local exp = math.floor(2 ^ n); |