From 195bbfb599ead875985663641562b46cf00b25db Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Sun, 15 Feb 2026 11:54:57 +0000 Subject: [PATCH] Fix test_prometheus_metrics-t to handle Prometheus labels Update parse_prometheus_metrics() to strip labels from metric names (e.g., 'metric{protocol="mysql"}' -> 'metric') so tests can use simple metric names without labels. Fixes #5378 --- test/tap/tap/utils.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/tap/tap/utils.cpp b/test/tap/tap/utils.cpp index bf9f3a13a2..73d10c352d 100644 --- a/test/tap/tap/utils.cpp +++ b/test/tap/tap/utils.cpp @@ -1855,7 +1855,13 @@ map parse_prometheus_metrics(const string& s) { for (const string ln : lines) { if (ln.empty() == false && ln[0] != '#') { pair p_line_val { split_line_by_last(ln, ' ') }; - metrics_map.insert({p_line_val.first, stod(p_line_val.second)}); + // Strip labels from metric name (e.g., "metric{label=\"value\"}" -> "metric") + string metric_name = p_line_val.first; + size_t brace_pos = metric_name.find('{'); + if (brace_pos != string::npos) { + metric_name = metric_name.substr(0, brace_pos); + } + metrics_map.insert({metric_name, stod(p_line_val.second)}); } }