Software /
code /
prosody
Changeset
12123:7ba686696250
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.
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Sun, 26 Dec 2021 22:32:00 +0100 |
parents | 12122:50795249b7be |
children | 12124:7d985e5bc1fb |
files | util/statistics.lua util/statsd.lua |
diffstat | 2 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/util/statistics.lua Sun Dec 26 16:26:36 2021 +0100 +++ b/util/statistics.lua Sun Dec 26 22:32:00 2021 +0100 @@ -102,7 +102,7 @@ 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
--- a/util/statsd.lua Sun Dec 26 16:26:36 2021 +0100 +++ b/util/statsd.lua Sun Dec 26 22:32:00 2021 +0100 @@ -115,7 +115,7 @@ 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