aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp
diff options
context:
space:
mode:
authorDmitry Razumov <dvrazumov@yandex-team.com>2024-05-03 15:30:56 +0200
committerGitHub <noreply@github.com>2024-05-03 15:30:56 +0200
commit6c226327540aef472fd8878dfe36ace8b3811726 (patch)
tree9db3e87a89f20d8bf129e46bc2c966e9a7750661 /library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp
parente1880f1134c52055e98b08a265c3ffef20ca6944 (diff)
downloadydb-6c226327540aef472fd8878dfe36ace8b3811726.tar.gz
Don't erase first numerical character in sensor name in prometheus format (#4226)
Co-authored-by: Dmitry Razumov <dvrazumov@yandex-team.ru>
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, 2 insertions, 4 deletions
diff --git a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp
index 8083221b63..fc482a4570 100644
--- a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp
+++ b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp
@@ -109,13 +109,11 @@ namespace NMonitoring {
Y_ENSURE(!name.Empty(), "trying to write metric with empty name");
char ch = name[0];
- if (NPrometheus::IsValidMetricNameStart(ch)) {
- Out_->Write(ch);
- } else {
+ if (!NPrometheus::IsValidMetricNameStart(ch)) {
Out_->Write('_');
}
- for (size_t i = 1, len = name.length(); i < len; i++) {
+ for (size_t i = 0, len = name.length(); i < len; i++) {
ch = name[i];
if (NPrometheus::IsValidMetricNameContinuation(ch)) {
Out_->Write(ch);