Hi Adis, On Thu, Jan 14, 2021 at 03:41:29PM +0100, Adis Nezirovic wrote: > From 6823e172b71590d4c540bddaa36add217828644c Mon Sep 17 00:00:00 2001 > From: Adis Nezirovic <aneziro...@haproxy.com> > Date: Wed, 13 Jan 2021 19:02:33 +0100 > Subject: [PATCH] BUG/MEDIUM: stats: Add missing INF_BUILD_INFO definition > > It was introduced in 5a982a7 "MINOR: contrib/prometheus-exporter: ..." > Lua function core.get_info() was broken, probably some other stuff.
oh ok I did not know it was mandatory to add it here when only used on prometheus side. But while reading hlua_get_info code I better understand. Is it something we could have caught in reg-tests? > --- > src/stats.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/stats.c b/src/stats.c > index 4ddcd7e41..c9359e346 100644 > --- a/src/stats.c > +++ b/src/stats.c > @@ -148,6 +148,7 @@ const struct name_desc info_fields[INF_TOTAL_FIELDS] = { > [INF_BYTES_OUT_RATE] = { .name = "BytesOutRate", > .desc = "Number of bytes emitted by current worker process over the > last second" }, > [INF_DEBUG_COMMANDS_ISSUED] = { .name = "DebugCommandsIssued", > .desc = "Number of debug commands issued on this process (anything > > 0 is unsafe)" }, > [INF_CUM_LOG_MSGS] = { .name = "CumRecvLogs", > .desc = "Total number of log messages received by log-forwarding > listeners on this worker process since started" }, > + [INF_BUILD_INFO] = { .name = "Build info", > .desc = "Build info" }, > }; > > const struct name_desc stat_fields[ST_F_TOTAL_FIELDS] = { > @@ -3911,6 +3912,7 @@ int stats_fill_info(struct field *info, int len) > info[INF_BYTES_OUT_RATE] = mkf_u64(FN_RATE, (unsigned > long long)read_freq_ctr(&global.out_32bps) * 32); > info[INF_DEBUG_COMMANDS_ISSUED] = mkf_u32(0, > debug_commands_issued); > info[INF_CUM_LOG_MSGS] = mkf_u32(FN_COUNTER, > cum_log_messages); > + info[INF_BUILD_INFO] = mkf_u32(FN_GAUGE, 1); if we add this default field here we could update prometheus at the same time: diff --git a/contrib/prometheus-exporter/service-prometheus.c b/contrib/prometheus-exporter/service-prometheus.c index 790b2f88e..6e36a7f04 100644 --- a/contrib/prometheus-exporter/service-prometheus.c +++ b/contrib/prometheus-exporter/service-prometheus.c @@ -1330,9 +1330,6 @@ static int promex_dump_global_metrics(struct appctx *appctx, struct htx *htx) while (appctx->st2 && appctx->st2 < INF_TOTAL_FIELDS) { switch (appctx->st2) { - case INF_BUILD_INFO: - metric = mkf_u32(FN_GAUGE, 1); - break; case INF_UPTIME_SEC: metric = mkf_u32(FN_DURATION, start_date.tv_sec); break; -- William