From 2e9d17608ab249a797773aa9170ee109bbe92131 Mon Sep 17 00:00:00 2001 From: Maxim Yurchuk Date: Wed, 21 May 2025 16:06:07 +0000 Subject: Sync main with rightlib (#18558) --- library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp') diff --git a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp index 0c6c23c466c..66c0f55b436 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp +++ b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp @@ -109,11 +109,13 @@ namespace NMonitoring { Y_ENSURE(!name.empty(), "trying to write metric with empty name"); char ch = name[0]; - if (!NPrometheus::IsValidMetricNameStart(ch)) { + if (NPrometheus::IsValidMetricNameStart(ch)) { + Out_->Write(ch); + } else { Out_->Write('_'); } - for (size_t i = 0, len = name.length(); i < len; i++) { + for (size_t i = 1, len = name.length(); i < len; i++) { ch = name[i]; if (NPrometheus::IsValidMetricNameContinuation(ch)) { Out_->Write(ch); -- cgit v1.3