made MetricValues persistent
MetricValues are persistent for reportUpdates AppendStopsWhenFull and
reportingType different than OnRequest.
Tested:
- New unit tests are passing
- Confirmed MetricValues are preserved after restarting telemetry
service
Change-Id: I7e1990fb391da9debb0d7df2f1dbda86473350cc
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/src/utils/circular_vector.hpp b/src/utils/circular_vector.hpp
index ba185ec..f7ac8e5 100644
--- a/src/utils/circular_vector.hpp
+++ b/src/utils/circular_vector.hpp
@@ -4,7 +4,8 @@
class CircularVector
{
public:
- explicit CircularVector(size_t maxSizeIn) : maxSize(maxSizeIn)
+ explicit CircularVector(std::vector<T>& externalVec, size_t maxSizeIn) :
+ vec(externalVec), maxSize(maxSizeIn)
{}
template <class... Args>
@@ -53,7 +54,7 @@
}
private:
+ std::vector<T>& vec;
size_t maxSize = 0;
size_t idx = 0;
- std::vector<T> vec;
};
diff --git a/src/utils/labeled_tuple.hpp b/src/utils/labeled_tuple.hpp
index 71bf4b0..e6203dd 100644
--- a/src/utils/labeled_tuple.hpp
+++ b/src/utils/labeled_tuple.hpp
@@ -76,6 +76,11 @@
return j;
}
+ const tuple_type& to_tuple() const
+ {
+ return value;
+ }
+
void from_json(const nlohmann::json& j)
{
from_json_all(j, std::make_index_sequence<sizeof...(Args)>());
diff --git a/src/utils/tstring.hpp b/src/utils/tstring.hpp
index e4529d8..67ad3c4 100644
--- a/src/utils/tstring.hpp
+++ b/src/utils/tstring.hpp
@@ -144,5 +144,45 @@
}
};
+struct MetricId
+{
+ static std::string str()
+ {
+ return "MetricId";
+ }
+};
+
+struct MetricProperty
+{
+ static std::string str()
+ {
+ return "MetricProperty";
+ }
+};
+
+struct MetricValue
+{
+ static std::string str()
+ {
+ return "MetricValue";
+ }
+};
+
+struct Timestamp
+{
+ static std::string str()
+ {
+ return "Timestamp";
+ }
+};
+
+struct Readings
+{
+ static std::string str()
+ {
+ return "Readings";
+ }
+};
+
} // namespace tstring
} // namespace utils