From 079a39c216927fefa0b5898e6dd4a8795d09764e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 27 Dec 2021 16:05:12 +0100 Subject: 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. --- util/statistics.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/statistics.lua') 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 -- cgit v1.2.3