aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2025-02-24 13:09:03 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2025-02-24 13:23:27 +0300
commitf2a79cefacab60f5d6c1d41e2067ca66e3e802b1 (patch)
treea7806f907648da7071cd5d8f83986f02fdc2978b
parent34cd625c20a22ff9a875012ece2d2d77945afb6a (diff)
downloadydb-f2a79cefacab60f5d6c1d41e2067ca66e3e802b1.tar.gz
Intermediate changes
commit_hash:fbe4363efc9f7388d7809e610cf668f00d2dfba1
-rw-r--r--yt/yt/core/misc/ema_counter-inl.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/yt/yt/core/misc/ema_counter-inl.h b/yt/yt/core/misc/ema_counter-inl.h
index 05a0aec6ef..eced52e06d 100644
--- a/yt/yt/core/misc/ema_counter-inl.h
+++ b/yt/yt/core/misc/ema_counter-inl.h
@@ -59,7 +59,10 @@ std::optional<double> TEmaCounter<T, WindowCount>::GetRate(int windowIndex, TIns
return {};
}
- return WindowRates[windowIndex];
+ YT_ASSERT(LastTimestamp.has_value());
+ auto timeDelta = (currentTimestamp - *LastTimestamp).SecondsFloat();
+ auto exp = std::exp(-timeDelta / (WindowDurations[windowIndex].SecondsFloat() / 2.0));
+ return WindowRates[windowIndex] * exp;
}
template <typename T, int WindowCount>