]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stats: allow to select one field in `stats_fill_sv_stats`
authorWilliam Dauchy <wdauchy@gmail.com>
Mon, 25 Jan 2021 16:29:03 +0000 (17:29 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 26 Jan 2021 08:24:51 +0000 (09:24 +0100)
commitd3a9a4992b0198b75caf0602016d8d90a3f6a6e9
tree5ae002690a71b98456e4cd3b2653109f779a87e5
parent3c6f006dc5e3e59b9a6489d6869917d5f687035d
MEDIUM: stats: allow to select one field in `stats_fill_sv_stats`

prometheus approach requires to output all values for a given metric
name; meaning we iterate through all metrics, and then iterate in the
inner loop on all objects for this metric.
In order to allow more code reuse, adapt the stats API to be able to
select one field or fill them all otherwise.
This patch follows what has already been done on frontend and backend
side.
From this patch it should be possible to remove most of the duplicate
code on prometheuse side for the server.

A few things to note though:
- state require prior calculation, so I moved that to a sort of helper
  `stats_fill_be_stats_computestate`.
- all ST_F*TIME fields requires some minor compute, so I moved it at te
  beginning of the function under a condition.

Signed-off-by: William Dauchy <wdauchy@gmail.com>
include/haproxy/stats.h
src/hlua_fcn.c
src/stats.c