File tree 3 files changed +11
-3
lines changed 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
16
- Throw an error when http_middelware is processing a wrong handler [ #199 ] ( https://github.com/tarantool/metrics/issues/199 )
17
17
- cartridge issues metric fails before cartridge.cfg() call [ #298 ] ( https://github.com/tarantool/metrics/issues/298 )
18
18
19
+ ### Changed
20
+ - quantile metric is nil if no samples provided for an age [ #303 ] ( https://github.com/tarantool/metrics/issues/303 )
21
+
19
22
## [ 0.10.0] - 2021-08-03
20
23
### Changed
21
24
- metrics registry refactoring to search with ` O(1) ` [ #188 ] ( https://github.com/tarantool/metrics/issues/188 )
Original file line number Diff line number Diff line change @@ -270,6 +270,11 @@ function quantile.Query(stream_obj, q)
270
270
-- Fast path when there hasn't been enough data for a flush;
271
271
-- this also yields better accuracy for small sets of data.
272
272
local l = stream_obj .b_len
273
+
274
+ if l == 0 then
275
+ return nil
276
+ end
277
+
273
278
local i = math.modf (l * q )
274
279
stream_obj :maybe_sort ()
275
280
return stream_obj .b [i ]
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ g.test_query_on_empty_quantile = function()
146
146
147
147
local res = quantile .Query (emptyQuantile , 0.99 )
148
148
149
- t .assert_equals (res , math.huge )
149
+ t .assert_equals (res , nil )
150
150
end
151
151
152
152
g .test_reset = function ()
@@ -156,12 +156,12 @@ g.test_reset = function()
156
156
end
157
157
158
158
local res = quantile .Query (Quantile , 0.99 )
159
- t .assert_not_equals (res , math.huge )
159
+ t .assert_not_equals (res , nil )
160
160
161
161
quantile .Reset (Quantile )
162
162
163
163
res = quantile .Query (Quantile , 0.99 )
164
- t .assert_equals (res , math.huge )
164
+ t .assert_equals (res , nil )
165
165
end
166
166
167
167
g .test_quantile_insert_works_after_reset = function ()
You can’t perform that action at this time.
0 commit comments