Hi guys,

Recent prometheus exporter patch broke stats (specifically Lua core.get_info() maybe other stuff)


The offending commit is:

commit 5a982a71656ce885be4b1d4b90b8db31204788a1
Author: William Dauchy <[email protected]>
Date:   Fri Jan 8 13:18:06 2021 +0100

    MINOR: contrib/prometheus-exporter: export build_info


I've attached a trivial patch which fixes the issue (I simply add missing definitions, but build info is hardcoded to 1, since I don't know where should I get that from).


Best regards,
--
Adis Nezirovic
Software Engineer
HAProxy Technologies - Powering your uptime!
375 Totten Pond Road, Suite 302 | Waltham, MA 02451, US
+1 (844) 222-4340 | https://www.haproxy.com
>From 6823e172b71590d4c540bddaa36add217828644c Mon Sep 17 00:00:00 2001
From: Adis Nezirovic <[email protected]>
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.
---
 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);

 	return 1;
 }
--
2.30.0

Reply via email to