summaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp
diff options
context:
space:
mode:
authorMaxim Yurchuk <[email protected]>2025-05-21 16:06:07 +0000
committerGitHub <[email protected]>2025-05-21 19:06:07 +0300
commit2e9d17608ab249a797773aa9170ee109bbe92131 (patch)
treea45624235891f73017d49ec936ce367dc6b9b728 /library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp
parent9ffb002de0fc457af277ed13c0c57e1325eeefe4 (diff)
Sync main with rightlib (#18558)
Diffstat (limited to 'library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp')
-rw-r--r--library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp6
1 files changed, 4 insertions, 2 deletions
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);