From: Willy Tarreau Date: Wed, 16 Sep 2026 11:59:34 +0000 (+0200) Subject: MINOR: promex: properly use alt_name and val instead of hard-coded values X-Git-Tag: v3.5-dev7~12 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=d3adda53a784033fef613201dab2f7d98504b862;p=haproxy.git MINOR: promex: properly use alt_name and val instead of hard-coded values Some string-based info from the "show info" output are returned as gauges in promex, and the way it's done consists in forcing their label's name and value to the desired name and values, then faking a value of 1 on the gauge. Since 3.2 with commit b03e05cd36 ("MINOR: stats: add alt name info to stat_cols_info where relevant"), this label's name appears in the stats info's alt_name field. Thus there's no need to hard-code it again in the promex code. Let's first do this for the "node" label. --- diff --git a/addons/promex/service-prometheus.c b/addons/promex/service-prometheus.c index d655c4345..76ea9a7a7 100644 --- a/addons/promex/service-prometheus.c +++ b/addons/promex/service-prometheus.c @@ -460,8 +460,8 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx) switch (ctx->field_num) { case ST_I_INF_NODE: - labels[lb_idx].name = ist("node"); - labels[lb_idx].value = ist(global.node); + labels[lb_idx].name = name; + labels[lb_idx].value = ist(field_str(&val, 0)); lb_idx++; val = mkf_u32(FN_GAUGE, 1); break;