aboutsummaryrefslogtreecommitdiffstats
path: root/util/statistics.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-12-27 16:05:12 +0100
committerKim Alvefur <zash@zash.se>2021-12-27 16:05:12 +0100
commit079a39c216927fefa0b5898e6dd4a8795d09764e (patch)
treed9a01d278df7da2371ec0c1af4f8ba7de4cc7232 /util/statistics.lua
parent569df0581e4d61e40ad032ccfc1c42deb2cf0516 (diff)
downloadprosody-079a39c216927fefa0b5898e6dd4a8795d09764e.tar.gz
prosody-079a39c216927fefa0b5898e6dd4a8795d09764e.zip
openmetrics/histograms: improve code clarity
If buckets thresholds are to be taken as "less than or equal to", then using the less than or equal to operator seems sensible.
Diffstat (limited to 'util/statistics.lua')
-rw-r--r--util/statistics.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/statistics.lua b/util/statistics.lua
index b76a7385..cb6481c5 100644
--- a/util/statistics.lua
+++ b/util/statistics.lua
@@ -102,7 +102,7 @@ end
function histogram_metric_mt:sample(value)
-- According to the I-D, values must be part of all buckets
for i, bucket in pairs(self) do
- if "number" == type(i) and bucket.threshold >= value then
+ if "number" == type(i) and value <= bucket.threshold then
bucket.count = bucket.count + 1
end
end