@@ -25,6 +25,10 @@ local function set_defaults_if_empty(cfg)
2525 cfg .stats_quantiles = false
2626 end
2727
28+ if cfg .stats_quantile_tolerated_error == nil then
29+ cfg .stats_quantile_tolerated_error = stats .DEFAULT_QUANTILE_TOLERATED_ERROR
30+ end
31+
2832 return cfg
2933end
3034
@@ -33,7 +37,8 @@ local cfg = set_defaults_if_empty(stash.get(stash.name.cfg))
3337local function configure_stats (cfg , opts )
3438 if (opts .stats == nil )
3539 and (opts .stats_driver == nil )
36- and (opts .stats_quantiles == nil ) then
40+ and (opts .stats_quantiles == nil )
41+ and (opts .stats_quantile_tolerated_error == nil ) then
3742 return
3843 end
3944
@@ -49,15 +54,24 @@ local function configure_stats(cfg, opts)
4954 opts .stats_quantiles = cfg .stats_quantiles
5055 end
5156
57+ if opts .stats_quantiles == nil then
58+ opts .stats_quantile_tolerated_error = cfg .stats_quantile_tolerated_error
59+ end
60+
5261 if opts .stats == true then
53- stats .enable { driver = opts .stats_driver , quantiles = opts .stats_quantiles }
62+ stats .enable {
63+ driver = opts .stats_driver ,
64+ quantiles = opts .stats_quantiles ,
65+ quantile_tolerated_error = opts .stats_quantile_tolerated_error ,
66+ }
5467 else
5568 stats .disable ()
5669 end
5770
5871 rawset (cfg , ' stats' , opts .stats )
5972 rawset (cfg , ' stats_driver' , opts .stats_driver )
6073 rawset (cfg , ' stats_quantiles' , opts .stats_quantiles )
74+ rawset (cfg , ' stats_quantile_tolerated_error' , opts .stats_quantile_tolerated_error )
6175end
6276
6377--- Configure CRUD module.
86100-- Enable or disable statistics quantiles (only for metrics driver).
87101-- Quantiles computations increases performance overhead up to 10%.
88102--
103+ -- @number[opt=1e-3] opts.stats_quantile_tolerated_error
104+ -- See tarantool/metrics summary API for details:
105+ -- https://www.tarantool.io/ru/doc/latest/book/monitoring/api_reference/#summary
106+ -- If quantile value is -Inf, try to decrease quantile tolerance.
107+ -- See https://github.com/tarantool/metrics/issues/189 for issue details.
108+ -- Decreasing the value increases computational load.
109+ --
89110-- @return Configuration table.
90111--
91112local function __call (self , opts )
92113 checks (' table' , {
93114 stats = ' ?boolean' ,
94115 stats_driver = ' ?string' ,
95- stats_quantiles = ' ?boolean'
116+ stats_quantiles = ' ?boolean' ,
117+ stats_quantile_tolerated_error = ' ?number' ,
96118 })
97119
98120 opts = table .deepcopy (opts ) or {}
0 commit comments