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/report_factory.hpp b/src/report_factory.hpp
index 0346441..de2bc02 100644
--- a/src/report_factory.hpp
+++ b/src/report_factory.hpp
@@ -14,13 +14,23 @@
std::shared_ptr<sdbusplus::asio::connection> bus,
const std::shared_ptr<sdbusplus::asio::object_server>& objServer);
- std::unique_ptr<interfaces::Report> make(
- std::optional<std::reference_wrapper<boost::asio::yield_context>> yield,
- const std::string& name, const std::string& reportingType,
- bool emitsReadingsSignal, bool logToMetricReportsCollection,
- std::chrono::milliseconds period, const ReadingParameters& metricParams,
- interfaces::ReportManager& reportManager,
- interfaces::JsonStorage& reportStorage) const override;
+ std::unique_ptr<interfaces::Report>
+ make(boost::asio::yield_context& yield, const std::string& name,
+ const std::string& reportingType, bool emitsReadingsSignal,
+ bool logToMetricReportsCollection,
+ std::chrono::milliseconds period,
+ const ReadingParameters& metricParams,
+ interfaces::ReportManager& reportManager,
+ interfaces::JsonStorage& reportStorage) const override;
+ std::unique_ptr<interfaces::Report>
+ make(const std::string& name, const std::string& reportingType,
+ bool emitsReadingsSignal, bool logToMetricReportsCollection,
+ std::chrono::milliseconds period,
+ const ReadingParameters& metricParams,
+ interfaces::ReportManager& reportManager,
+ interfaces::JsonStorage& reportStorage,
+ std::vector<LabeledMetricParameters> labeledMetricParams)
+ const override;
private:
using SensorPath = std::string;
@@ -30,10 +40,10 @@
using SensorTree = std::pair<SensorPath, SensorIfaces>;
std::vector<std::shared_ptr<interfaces::Sensor>> getSensors(
- const std::optional<std::vector<SensorTree>>& tree,
- const std::vector<sdbusplus::message::object_path>& sensorPaths) const;
- std::vector<SensorTree>
- getSensorTree(boost::asio::yield_context& yield) const;
+ const std::vector<LabeledSensorParameters>& sensorPaths) const;
+ std::vector<LabeledMetricParameters>
+ convertMetricParams(boost::asio::yield_context& yield,
+ const ReadingParameters& metricParams) const;
std::shared_ptr<sdbusplus::asio::connection> bus;
std::shared_ptr<sdbusplus::asio::object_server> objServer;