Software /
code /
prosody
Comparison
util/statsd.lua @ 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 |
parent | 11523:5f15ab7c6ae5 |
child | 12124:7d985e5bc1fb |
comparison
equal
deleted
inserted
replaced
12122:50795249b7be | 12123:7ba686696250 |
---|---|
113 end | 113 end |
114 | 114 |
115 function histogram_metric_mt:sample(value) | 115 function histogram_metric_mt:sample(value) |
116 -- According to the I-D, values must be part of all buckets | 116 -- According to the I-D, values must be part of all buckets |
117 for i, bucket in pairs(self) do | 117 for i, bucket in pairs(self) do |
118 if "number" == type(i) and bucket.threshold > value then | 118 if "number" == type(i) and bucket.threshold >= value then |
119 bucket.count = bucket.count + 1 | 119 bucket.count = bucket.count + 1 |
120 self._impl:push_counter_delta(bucket._full_name, 1) | 120 self._impl:push_counter_delta(bucket._full_name, 1) |
121 end | 121 end |
122 end | 122 end |
123 self._sum = self._sum + value | 123 self._sum = self._sum + value |