Removed FutureVersion from API
Instead of using FutureVersion API currently used version is updated.
This change needs to be bumped together with [1]. API that utilized map
of variants to be more flexible and backwards compatible was reverted.
It was decided that straight forward API that is commonly used should be
used instead.
Removed MetricId property from Metric. In telemetry it was implemented
as a name for Metric, but it was supposed to work as described in [2].
Currently MetricId is not supported by telemetry service and property
was removed.
Tested:
- After chaging bmcweb to use new API old and new features are working
as expected
[1]: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/44270
[2]: https://redfish.dmtf.org/schemas/v1/MetricReportDefinition.v1_4_2.json
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I5930a466a370f268d68f575a4a3db5ee9655e574
diff --git a/src/report_factory.cpp b/src/report_factory.cpp
index d3a9bb0..5f80355 100644
--- a/src/report_factory.cpp
+++ b/src/report_factory.cpp
@@ -26,19 +26,19 @@
std::vector<LabeledMetricParameters> labeledMetricParams, bool enabled,
Readings readings) const
{
- auto metrics = utils::transform(
- labeledMetricParams,
- [this](const LabeledMetricParameters& param)
- -> std::shared_ptr<interfaces::Metric> {
- namespace ts = utils::tstring;
+ auto metrics =
+ utils::transform(labeledMetricParams,
+ [this](const LabeledMetricParameters& param)
+ -> std::shared_ptr<interfaces::Metric> {
+ namespace ts = utils::tstring;
- return std::make_shared<Metric>(
- getSensors(param.at_label<ts::SensorPath>()),
- param.at_label<ts::OperationType>(), param.at_label<ts::Id>(),
- param.at_label<ts::CollectionTimeScope>(),
- param.at_label<ts::CollectionDuration>(),
- std::make_unique<Clock>());
- });
+ return std::make_shared<Metric>(
+ getSensors(param.at_label<ts::SensorPath>()),
+ param.at_label<ts::OperationType>(),
+ param.at_label<ts::CollectionTimeScope>(),
+ param.at_label<ts::CollectionDuration>(),
+ std::make_unique<Clock>());
+ });
return std::make_unique<Report>(
bus->get_io_context(), objServer, id, name, reportingType,
@@ -72,7 +72,6 @@
newMetrics.emplace_back(std::make_shared<Metric>(
getSensors(labeledMetricParam.at_label<ts::SensorPath>()),
labeledMetricParam.at_label<ts::OperationType>(),
- labeledMetricParam.at_label<ts::Id>(),
labeledMetricParam.at_label<ts::CollectionTimeScope>(),
labeledMetricParam.at_label<ts::CollectionDuration>(),
std::make_unique<Clock>()));
@@ -142,7 +141,7 @@
try
{
return utils::transform(metricParams, [&tree](const auto& item) {
- auto [sensorPaths, operationType, id, collectionTimeScope,
+ auto [sensorPaths, operationType, collectionTimeScope,
collectionDuration] = item;
std::vector<LabeledSensorInfo> sensorParameters;
@@ -187,7 +186,7 @@
return LabeledMetricParameters(
std::move(sensorParameters),
- utils::toOperationType(operationType), id,
+ utils::toOperationType(operationType),
utils::toCollectionTimeScope(collectionTimeScope),
CollectionDuration(Milliseconds(collectionDuration)));
});