From b05712cf837f45b2dbcd42aeae2250fdd0b3e87a Mon Sep 17 00:00:00 2001 From: Jakob Date: Fri, 12 Dec 2025 10:04:51 +0100 Subject: [PATCH] fix: check for duplicate labels --- src/core/system.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/system.cpp b/src/core/system.cpp index aa39b3b34..d67a112b4 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -1751,7 +1751,18 @@ std::string System::get_metrics_prometheus() { // collect string for info metric (skip dynamic strings like uptime and timestamp) std::string val = p.value().as(); if (!val.empty() && key != "uptime" && key != "timestamp") { - local_info_labels.push_back({to_lowercase(key), val}); + std::string lower_key = to_lowercase(key); + // check if key already exists in local_info_labels + bool key_exists = false; + for (const auto & label : local_info_labels) { + if (label.first == lower_key) { + key_exists = true; + break; + } + } + if (!key_exists) { + local_info_labels.push_back({lower_key, val}); + } } } }