MINOR: contrib/prometheus-exporter: use fill_be_stats for backend dump
authorWilliam Dauchy <wdauchy@gmail.com>
Mon, 25 Jan 2021 16:29:02 +0000 (17:29 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 26 Jan 2021 08:24:36 +0000 (09:24 +0100)
commit3c6f006dc5e3e59b9a6489d6869917d5f687035d
treedc458de704a4b2a5434cc7e1b3f42fbc213a36e5
parentda3b466fc2f958e986d3c06ac19084a0a6133cd0
MINOR: contrib/prometheus-exporter: use fill_be_stats for backend dump

use `stats_fill_be_stats` when possible to avoid duplicating code; make
use of field selector to get the needed field only.

the only difference is on `haproxy_backend_downtime_seconds_total` as
stats.c is testing `px->srv`. This behaviour is present since commit
7344f4789321ef8ce2ce17cf73dabd672f7c8c6 ("MINOR: stats: only report
backend's down time if it has servers"). The end result is a NaN instead
of a zero when no server are present.

Signed-off-by: William Dauchy <wdauchy@gmail.com>
contrib/prometheus-exporter/service-prometheus.c