mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 14:51:27 +02:00
MEDIUM: cli: adjust the method for feeding frequency counters in tables
Since commit 654694e1, it has been possible to feed some data into stick tables from the CLI. That commit considered that frequency counters would only have their previous value set, so that they progressively fade out. But this does not match any real world use case in fact. The only reason for feeding a freq counter is to pass some data learned outside. We certainly don't want to see such data start to vanish immediately, otherwise it will force the external scripts to loop very frequently to limit the losses. So let's set the current value instead in order to guarantee that the data remains stable over the full period, then starts to fade out between 1* and 2* the period.
This commit is contained in:
parent
0f791d42b6
commit
ce54d1b9f2
@ -730,11 +730,15 @@ static void stats_sock_table_key_request(struct stream_interface *si, char **arg
|
||||
stktable_data_cast(ptr, std_t_ull) = value;
|
||||
break;
|
||||
case STD_T_FRQP:
|
||||
/* We only reset the previous value so that it slowly fades out */
|
||||
/* We set both the current and previous values. That way
|
||||
* the reported frequency is stable during all the period
|
||||
* then slowly fades out. This allows external tools to
|
||||
* push measures without having to update them too often.
|
||||
*/
|
||||
frqp = &stktable_data_cast(ptr, std_t_frqp);
|
||||
frqp->curr_tick = now_ms;
|
||||
frqp->prev_ctr = value;
|
||||
frqp->curr_ctr = 0;
|
||||
frqp->prev_ctr = 0;
|
||||
frqp->curr_ctr = value;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user