fixed issue with invalid readings being visible
Before this change readings for sensors that are not yet available were
displayed as value 0.0 with timestamp 1970-01-01 which was meant to
represent invalid readings. This behaviour is undesired in case of
periodic report with appendLimit set. After this change invalid readings
are no longer visible.
Tested:
- Readings for sensors that is currently not available are not present
on redfish.
- Confirmed in new unit tests that sensor readings can appear in any
order. And produce correct results.
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I340b85017530d120f2da2cc8ac4ae1840177e78c
diff --git a/src/interfaces/metric.hpp b/src/interfaces/metric.hpp
index c40e960..c52dd45 100644
--- a/src/interfaces/metric.hpp
+++ b/src/interfaces/metric.hpp
@@ -19,7 +19,7 @@
virtual void initialize() = 0;
virtual void deinitialize() = 0;
- virtual std::vector<MetricValue> getReadings() const = 0;
+ virtual const std::vector<MetricValue>& getUpdatedReadings() = 0;
virtual LabeledMetricParameters dumpConfiguration() const = 0;
virtual uint64_t sensorCount() const = 0;
virtual void registerForUpdates(interfaces::MetricListener& listener) = 0;