aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorJonas Schäfer <jonas@wielicki.name>2021-12-26 22:32:00 +0100
committerJonas Schäfer <jonas@wielicki.name>2021-12-26 22:32:00 +0100
commit569df0581e4d61e40ad032ccfc1c42deb2cf0516 (patch)
tree26b561644637fabe189abca8ebf0f8c4006c15da /util
parent257f52d826db491f3861a5a7546faf6c940bb629 (diff)
downloadprosody-569df0581e4d61e40ad032ccfc1c42deb2cf0516.tar.gz
prosody-569df0581e4d61e40ad032ccfc1c42deb2cf0516.zip
openmetrics/histograms: fix incorrect condition for bucketing
The buckets thresholds are to be taken as "less than or equal to". The condition as written in the code did only "less than", not "less than or equal to". That's fixed now.
Diffstat (limited to 'util')
-rw-r--r--util/statistics.lua2
-rw-r--r--util/statsd.lua2
2 files changed, 2 insertions, 2 deletions
diff --git a/util/statistics.lua b/util/statistics.lua
index a8401168..b76a7385 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 bucket.threshold >= value then
bucket.count = bucket.count + 1
end
end
diff --git a/util/statsd.lua b/util/statsd.lua
index 25e03e38..b91e2a79 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 bucket.threshold >= value then
bucket.count = bucket.count + 1
self._impl:push_counter_delta(bucket._full_name, 1)
end