aboutsummaryrefslogtreecommitdiffstats
path: root/util/statsd.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/statsd.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/statsd.lua')
-rw-r--r--util/statsd.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/statsd.lua b/util/statsd.lua
index b91e2a79..6ae85c31 100644
--- a/util/statsd.lua
+++ b/util/statsd.lua
@@ -115,7 +115,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
self._impl:push_counter_delta(bucket._full_name, 1)
end