Review fixes for 'Created metric class'
- Changed metric to_json to dumpConfiguration returning LabeledTuple
- LabeledTuple can be created and assigned directly to json
- LabeledTuple can be readed from json using json.get<LabeledTuple>
- Added PrintTo for LabeledMetricParams, LabeledSensorParams
- Added helper method expectMake to ReportFactoryMock
- sensorPaths are serialized to tuple<service, path> instead of single
field with service and path separated via ':'
- Changed configuration version from 1 to 2
Change-Id: I7c45fb584687172f88fd549a93329264793b0b8e
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/src/metric.cpp b/src/metric.cpp
index 8d9f19b..b12f3a6 100644
--- a/src/metric.cpp
+++ b/src/metric.cpp
@@ -52,13 +52,11 @@
return readings.at(index);
}
-nlohmann::json Metric::to_json() const
+LabeledMetricParameters Metric::dumpConfiguration() const
{
- auto sensorPaths = utils::transform(
- sensors, [](const auto& sensor) -> sdbusplus::message::object_path {
- return sdbusplus::message::object_path(sensor->id().service + ":" +
- sensor->id().path);
- });
- return LabeledReadingParameter::to_json(ReadingParameters::value_type(
- std::move(sensorPaths), operationType, id, metadata));
+ auto sensorPaths = utils::transform(sensors, [](const auto& sensor) {
+ return LabeledSensorParameters(sensor->id().service, sensor->id().path);
+ });
+ return LabeledMetricParameters(std::move(sensorPaths), operationType, id,
+ metadata);
}