Le 11/01/2021 à 20:07, William Dauchy a écrit :
Hi Christopher,
This first patch set to start cleaning prometheus and reuse more of
stats.c. I know this is not yet what we aimed in terms of reuse,
especially for the defines, but this is a starting point, hoping I did
not break everything. At least it is more incremental.
The first patch is around what we discussed very recently around
connection handling, and the rest is a first attempt to use fill_*
functions from stats.c
William Dauchy (5):
MINOR: contrib/prometheus-exporter: avoid connection close header
MINOR: contrib/prometheus-exporter: use fill_info for process dump
MINOR: contrib/prometheus-exporter: use fill_fe_stats for frontend
dump
MINOR: contrib/prometheus-exporter: use fill_be_stats for backend dump
MINOR: contrib/prometheus-exporter: use fill_sv_stats for server dump
.../prometheus-exporter/service-prometheus.c | 619 ++----------------
include/haproxy/stats.h | 4 +-
reg-tests/contrib/prometheus.vtc | 8 -
src/stats.c | 6 +-
4 files changed, 47 insertions(+), 590 deletions(-)
Hi william,
The first 2 patches are ok. Relying on fill_info is indeed cleaner. However, for
the last three patches, it is more annoying. The result is clean of course but
the fill_* functions will then be called one time for each metric for a given
frontend/backend/server because of the Prometheus output format. For instance,
if you have a backend with 100 servers, fill_sv_stats will be called 100 times
for each metric, thus approximately 5000 times.
For now, I will only merge the first two patch if it's ok for you. For the
other, I guess the stats api may be changed to fill all metric or a specific one.
--
Christopher Faulet