aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraleksei-le <aleksei-le@yandex-team.com>2024-02-06 12:16:42 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-02-09 19:18:13 +0300
commit4cd334e7f2818a04ab4b34324e5367815f0ec1fd (patch)
treec3bd05b1909617c65e0d5e63d818a18fbf26b12c
parentf8d4b4599b3631338caba29788bafdd99a807967 (diff)
downloadydb-4cd334e7f2818a04ab4b34324e5367815f0ec1fd.tar.gz
fix prometheus_decoder ConsumeCounter
-rw-r--r--library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp
index fb6466dba9..d1d0d9e0f2 100644
--- a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp
+++ b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp
@@ -531,10 +531,12 @@ namespace NMonitoring {
}
void ConsumeCounter(TStringBuf name, const TLabelsMap& labels, TInstant time, double value) {
- i64 intValue{0};
+ ui64 uintValue{0};
// not nan
- if (value == value) {
- Y_PARSER_ENSURE(TryStaticCast(value, intValue), "value " << value << " is out of range");
+ if (value == value && value > 0) {
+ if (!TryStaticCast(value, uintValue)) {
+ uintValue = std::numeric_limits<ui64>::max();
+ }
}
// see https://st.yandex-team.ru/SOLOMON-4142 for more details
@@ -542,7 +544,7 @@ namespace NMonitoring {
// TODO: need to fix after server-side aggregation become correct for COUNTERs
Consumer_->OnMetricBegin(EMetricType::RATE);
ConsumeLabels(name, labels);
- Consumer_->OnUint64(time, intValue);
+ Consumer_->OnUint64(time, uintValue);
Consumer_->OnMetricEnd();
}