aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraleksei-le <aleksei-le@yandex-team.com>2024-02-06 12:16:42 +0300
committeraleksei-le <aleksei-le@yandex-team.com>2024-02-06 12:39:13 +0300
commita54d30580d0abf80b086d856e9d473f20109665a (patch)
treee349f50ebd4a552b9a0ce70a35e783898729c8b2
parentf4e5229f058bb21a8e634dd57f78585b40abd65a (diff)
downloadydb-a54d30580d0abf80b086d856e9d473f20109665a.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();
}