health metric: use instantaneous value
For health metric value update use the instantaneous value rather than
average value as initial average value calculation takes around 2 mins
because of window size requirement.
Change-Id: I5e53536b79374a75b1ddfa18ab7a6f782c5ae361
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/health_metric.cpp b/health_metric.cpp
index 31de153..31feb55 100644
--- a/health_metric.cpp
+++ b/health_metric.cpp
@@ -207,7 +207,9 @@
void HealthMetric::update(MValue value)
{
- // Maintain window size for metric
+ ValueIntf::value(value.current);
+
+ // Maintain window size for threshold calculation
if (history.size() >= config.windowSize)
{
history.pop_front();
@@ -223,7 +225,7 @@
double average = (std::accumulate(history.begin(), history.end(), 0.0)) /
history.size();
- ValueIntf::value(average);
+ value.current = average;
checkThresholds(value);
}