diff options
author | eportnov <eportnov@ibs.ru> | 2022-09-09 10:37:04 +0300 |
---|---|---|
committer | eportnov <eportnov@ibs.ru> | 2022-09-09 10:37:04 +0300 |
commit | b4ee6951877dda289ad12adaf3cc470d8a27190e (patch) | |
tree | 5cdb23b2144791f0e31e2af337a99840076d101c /meta-ibs/meta-cp2-5422/recipes-phosphor | |
parent | 912fdaf72451d947a89fc80968c854505a41c288 (diff) | |
parent | c2b58395cbb4fd0fec20e41df53e399538d02471 (diff) | |
download | openbmc-b4ee6951877dda289ad12adaf3cc470d8a27190e.tar.xz |
Merge branch 'feature/telemetry/rebase' into sila-rebase
Diffstat (limited to 'meta-ibs/meta-cp2-5422/recipes-phosphor')
21 files changed, 783 insertions, 1419 deletions
diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0011-configure-telemetry.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0011-configure-telemetry.patch new file mode 100644 index 0000000000..d77457ce7a --- /dev/null +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0011-configure-telemetry.patch @@ -0,0 +1,89 @@ +From 1920d507c28baa6ca9ec3de3694a2df218a4f265 Mon Sep 17 00:00:00 2001 +From: eportnov <eportnov@ibs.ru> +Date: Thu, 8 Sep 2022 14:25:36 +0300 +Subject: [PATCH] configure telemetry + +--- + include/dbus_utility.hpp | 1 + + redfish-core/lib/metric_report.hpp | 39 +++++++++++++++++++++++++----- + 2 files changed, 34 insertions(+), 6 deletions(-) + +diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp +index bd0d64bd..05adb1e6 100644 +--- a/include/dbus_utility.hpp ++++ b/include/dbus_utility.hpp +@@ -62,6 +62,7 @@ using DbusVariantType = std::variant< + std::vector<uint16_t>, + sdbusplus::message::object_path, + std::tuple<uint64_t, std::vector<std::tuple<std::string, std::string, double, uint64_t>>>, ++ std::tuple<uint64_t, std::vector<std::tuple<std::string, double, uint64_t>>>, + std::vector<std::tuple<std::string, std::string>>, + std::vector<std::tuple<uint32_t, std::vector<uint32_t>>>, + std::vector<std::tuple<uint32_t, size_t>>, +diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp +index 18830f13..b3f5721e 100644 +--- a/redfish-core/lib/metric_report.hpp ++++ b/redfish-core/lib/metric_report.hpp +@@ -20,20 +20,47 @@ constexpr const char* metricReportUri = + "/redfish/v1/TelemetryService/MetricReports"; + + using Readings = +- std::vector<std::tuple<std::string, std::string, double, uint64_t>>; ++ std::vector<std::tuple<std::string, double, uint64_t>>; + using TimestampReadings = std::tuple<uint64_t, Readings>; + ++inline std::string GetCroppedTimeStamp(uint64_t timestamp) ++{ ++ static constexpr char DOT_CHAR = '.'; ++ ++ auto timestamp_as_string = redfish::time_utils::getDateTimeUintMs(timestamp); ++ auto last_dot_position = timestamp_as_string.rfind(DOT_CHAR); ++ if(last_dot_position != std::string::npos) ++ { ++ timestamp_as_string.erase(last_dot_position); ++ } ++ return timestamp_as_string; ++} ++ ++inline std::string GetCroppedValue(double value) ++{ ++ static constexpr char DOT_CHAR = '.'; ++ static constexpr size_t COUNT_NUMBER_AFTER_DOT = 1; ++ ++ auto value_as_string = std::to_string(value); ++ auto last_dot_position = value_as_string.rfind(DOT_CHAR); ++ auto general_size = last_dot_position + COUNT_NUMBER_AFTER_DOT + sizeof(DOT_CHAR); ++ if(last_dot_position != std::string::npos && general_size <= value_as_string.length()) ++ { ++ value_as_string.erase(general_size); ++ } ++ return value_as_string; ++} ++ + inline nlohmann::json toMetricValues(const Readings& readings) + { + nlohmann::json metricValues = nlohmann::json::array_t(); + +- for (const auto& [id, metadata, sensorValue, timestamp] : readings) ++ for (const auto& [metadata, sensorValue, timestamp] : readings) + { + metricValues.push_back({ +- {"MetricId", id}, +- {"MetricProperty", metadata}, +- {"MetricValue", std::to_string(sensorValue)}, +- {"Timestamp", redfish::time_utils::getDateTimeUintMs(timestamp)}, ++ {"Sensor", metadata}, ++ {"Value", GetCroppedValue(sensorValue)}, ++ {"Timestamp", GetCroppedTimeStamp(timestamp)}, + }); + } + +@@ -56,7 +83,7 @@ inline bool fillReport(nlohmann::json& json, const std::string& id, + .string(); + + const auto& [timestamp, readings] = timestampReadings; +- json["Timestamp"] = redfish::time_utils::getDateTimeUintMs(timestamp); ++ json["Timestamp"] = GetCroppedTimeStamp(timestamp); + json["MetricValues"] = toMetricValues(readings); + return true; + } diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0012-add-telemetry-hour-data.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0012-add-telemetry-hour-data.patch new file mode 100644 index 0000000000..f835ac2ca5 --- /dev/null +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0012-add-telemetry-hour-data.patch @@ -0,0 +1,191 @@ +From 8115dec92eb59b60e48295d3d94e739e138c22b3 Mon Sep 17 00:00:00 2001 +From: eportnov <eportnov@ibs.ru> +Date: Thu, 8 Sep 2022 15:22:48 +0300 +Subject: [PATCH] add telemetry hour data + +--- + redfish-core/lib/metric_report.hpp | 148 +++++++++++++++++++++++------ + 1 file changed, 119 insertions(+), 29 deletions(-) + +diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp +index b3f5721e..64808a9c 100644 +--- a/redfish-core/lib/metric_report.hpp ++++ b/redfish-core/lib/metric_report.hpp +@@ -16,6 +16,20 @@ namespace redfish + namespace telemetry + { + ++enum class Params ++{ ++ ReportName, ++ IdGroup, ++ Period, ++}; ++ ++enum class Periods ++{ ++ All, ++ LastHour, ++ None, ++}; ++ + constexpr const char* metricReportUri = + "/redfish/v1/TelemetryService/MetricReports"; + +@@ -87,6 +101,81 @@ inline bool fillReport(nlohmann::json& json, const std::string& id, + json["MetricValues"] = toMetricValues(readings); + return true; + } ++ ++inline telemetry::Periods ConvertPeriod(std::string const& period_as_string) ++{ ++ if( period_as_string == "all" ) ++ { ++ return telemetry::Periods::All; ++ } ++ else if( period_as_string == "last_hour" ) ++ { ++ return telemetry::Periods::LastHour; ++ } ++ return telemetry::Periods::None; ++} ++ ++inline std::pair<Params, std::string> BuildPairParams(std::vector<std::string> const& params_as_string) ++{ ++ static constexpr int SIZE_OF_PAIR = 2; ++ ++ std::pair<telemetry::Params, std::string> result; ++ ++ if(params_as_string.empty() || params_as_string.size() > SIZE_OF_PAIR ) ++ { ++ return result; ++ } ++ if(params_as_string[0] == "id") ++ { ++ result.first = telemetry::Params::IdGroup; ++ result.second = params_as_string[1]; ++ } ++ else if(params_as_string[0] == "period") ++ { ++ result.first = telemetry::Params::Period; ++ result.second = params_as_string[1]; ++ } ++ else if( params_as_string[0] == "report" ) ++ { ++ result.first = telemetry::Params::ReportName; ++ result.second = params_as_string[1]; ++ } ++ return result; ++} ++ ++inline std::vector<std::string> ParseLine( std::string const& line, std::string const& delimiter ) ++{ ++ std::vector<std::string> result; ++ ++ auto start = 0U; ++ auto end = line.find(delimiter); ++ while(end != std::string::npos) ++ { ++ auto parsed = line.substr(start, end - start); ++ result.push_back(parsed); ++ start = end + delimiter.length(); ++ end = line.find(delimiter, start); ++ } ++ auto parsed = line.substr(start, end); ++ result.push_back(parsed); ++ return result; ++} ++ ++inline std::unordered_map<telemetry::Params, std::string> BuildParams(std::vector<std::string> const& parsed_data) ++{ ++ static const std::string DELIMITER_ON_PARAMETER = "="; ++ ++ std::unordered_map<telemetry::Params, std::string> result; ++ for(const auto& not_parsed_param : parsed_data) ++ { ++ auto param_pair = ParseLine( not_parsed_param, DELIMITER_ON_PARAMETER ); ++ auto pair_params = BuildPairParams( param_pair ); ++ result.insert( pair_params ); ++ } ++ return result; ++} ++ ++ + } // namespace telemetry + + inline void requestRoutesMetricReportCollection(App& app) +@@ -119,44 +208,45 @@ inline void requestRoutesMetricReport(App& app) + .methods(boost::beast::http::verb::get)( + [&app](const crow::Request& req, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, +- const std::string& id) { ++ const std::string& params) { + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) + { + return; + } +- const std::string reportPath = telemetry::getDbusReportPath(id); +- crow::connections::systemBus->async_method_call( +- [asyncResp, id, reportPath](const boost::system::error_code& ec) { +- if (ec.value() == EBADR || +- ec == boost::system::errc::host_unreachable) +- { +- messages::resourceNotFound(asyncResp->res, "MetricReport", id); +- return; +- } +- if (ec) +- { +- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec; +- messages::internalError(asyncResp->res); +- return; +- } +- +- sdbusplus::asio::getProperty<telemetry::TimestampReadings>( +- *crow::connections::systemBus, telemetry::service, reportPath, +- telemetry::reportInterface, "Readings", +- [asyncResp, id](const boost::system::error_code ec2, +- const telemetry::TimestampReadings& ret) { +- if (ec2) ++ static const std::string DELIMITER_ON_LINE = "&"; ++ ++ auto full_params = "report=" + params; ++ auto parsed_params = telemetry::BuildParams( telemetry::ParseLine( full_params, DELIMITER_ON_LINE ) ); ++ ++ auto report_name_it = parsed_params.find(telemetry::Params::ReportName); ++ auto report_name = report_name_it != parsed_params.end() ? report_name_it->second : ""; ++ ++ auto period_it = parsed_params.find(telemetry::Params::Period); ++ auto period = period_it != parsed_params.end() ? period_it->second : ""; ++ ++ const std::string reportPath = telemetry::getDbusReportPath(report_name); ++ ++ auto is_need_last_hour = telemetry::ConvertPeriod(period) == telemetry::Periods::LastHour; ++ ++ crow::connections::systemBus->async_method_call([asyncResp, report_name, period](const boost::system::error_code& error_code, ++ const telemetry::TimestampReadings& ret){ ++ if(error_code.value() == EBADR || ++ error_code == boost::system::errc::host_unreachable) + { +- BMCWEB_LOG_ERROR << "respHandler DBus error " << ec2; +- messages::internalError(asyncResp->res); ++ std::cout << "first error " << std::endl; ++ std::cout << "host_unreachable" << std::endl; + return; + } ++ if(error_code) ++ { ++ std::cout << "respHandler DBus error " << error_code << std::endl; ++ return; ++ } + +- telemetry::fillReport(asyncResp->res.jsonValue, id, ret); +- }); ++ telemetry::fillReport(asyncResp->res.jsonValue,report_name, ret); + }, + telemetry::service, reportPath, telemetry::reportInterface, +- "Update"); +- }); ++ "GetReadings", is_need_last_hour); ++ }); + } + } // namespace redfish diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0013-bugfix-telemetry-circular-buffer.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0013-bugfix-telemetry-circular-buffer.patch new file mode 100644 index 0000000000..9f7f538dbd --- /dev/null +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb/0013-bugfix-telemetry-circular-buffer.patch @@ -0,0 +1,43 @@ +From 38a09080bb7bb43700b2fb021cd20137e7a3acad Mon Sep 17 00:00:00 2001 +From: eportnov <eportnov@ibs.ru> +Date: Thu, 8 Sep 2022 17:38:05 +0300 +Subject: [PATCH] bugfix telemetry circular buffer + +--- + include/dbus_utility.hpp | 2 ++ + redfish-core/lib/metric_report.hpp | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp +index 05adb1e6..3aa694b7 100644 +--- a/include/dbus_utility.hpp ++++ b/include/dbus_utility.hpp +@@ -31,6 +31,7 @@ + #include <utility> + #include <variant> + #include <vector> ++#include <list> + + // IWYU pragma: no_include <stddef.h> + // IWYU pragma: no_include <stdint.h> +@@ -63,6 +64,7 @@ using DbusVariantType = std::variant< + sdbusplus::message::object_path, + std::tuple<uint64_t, std::vector<std::tuple<std::string, std::string, double, uint64_t>>>, + std::tuple<uint64_t, std::vector<std::tuple<std::string, double, uint64_t>>>, ++ std::tuple<uint64_t, std::list<std::tuple<std::string, double, uint64_t>>>, + std::vector<std::tuple<std::string, std::string>>, + std::vector<std::tuple<uint32_t, std::vector<uint32_t>>>, + std::vector<std::tuple<uint32_t, size_t>>, +diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp +index 64808a9c..68500902 100644 +--- a/redfish-core/lib/metric_report.hpp ++++ b/redfish-core/lib/metric_report.hpp +@@ -34,7 +34,7 @@ constexpr const char* metricReportUri = + "/redfish/v1/TelemetryService/MetricReports"; + + using Readings = +- std::vector<std::tuple<std::string, double, uint64_t>>; ++ std::list<std::tuple<std::string, double, uint64_t>>; + using TimestampReadings = std::tuple<uint64_t, Readings>; + + inline std::string GetCroppedTimeStamp(uint64_t timestamp) diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend index a6258f3f6e..38791694d6 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/interfaces/bmcweb_%.bbappend @@ -7,13 +7,11 @@ SRC_URI += "\ file://0007-Removed-non-working-boot-override-modes.patch \ file://0008-Add-pcie-device-names.patch \ file://0010-Add-smtp-client.patch \ + file://0011-configure-telemetry.patch \ + file://0012-add-telemetry-hour-data.patch \ + file://0013-bugfix-telemetry-circular-buffer.patch \ " -#SRC_URI += "\ -# file://0004-configure-telemetry.patch \ -# file://0009-fix-circular-buffer-telemetry.patch \ -# " - EXTRA_OEMESON += "\ -Dredfish-host-logger=enabled \ -Dredfish-dump-log=enabled \ diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0001-configure-telemetry.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0001-configure-telemetry.patch new file mode 100644 index 0000000000..91b64d6e30 --- /dev/null +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0001-configure-telemetry.patch @@ -0,0 +1,121 @@ +From 00985aa2686a9277291b1fc744d78899a0e33807 Mon Sep 17 00:00:00 2001 +From: eportnov <eportnov@ibs.ru> +Date: Thu, 8 Sep 2022 14:26:35 +0300 +Subject: [PATCH] configure telemetry + +--- + meson_options.txt | 4 ++-- + src/metric.cpp | 2 +- + src/metric_value.hpp | 1 - + src/report.cpp | 6 +++--- + src/types/readings.hpp | 4 ++-- + src/utils/dbus_path_utils.hpp | 2 +- + 6 files changed, 9 insertions(+), 10 deletions(-) + +diff --git a/meson_options.txt b/meson_options.txt +index c8a46b8..0a50b7d 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -1,5 +1,5 @@ + option('buildtest', type: 'boolean', value: true, description: 'Build tests') +-option('max-reports', type: 'integer', min: 0, value: 10, ++option('max-reports', type: 'integer', min: 0, value: 20, + description: 'Max number of Reports') + option('max-reading-parameters', type: 'integer', min: 0, value: 200, + description: 'Max number of metric properties in single report') +@@ -9,7 +9,7 @@ option('max-triggers', type: 'integer', min: 0, value: 10, + description: 'Max number of Triggers') + option('max-dbus-path-length', type: 'integer', min: 256, value: 4095, + description: 'Max length of dbus object path') +-option('max-append-limit', type: 'integer', min: 0, value: 256, ++option('max-append-limit', type: 'integer', min: 0, value: 2147483647, + description: 'Max AppendLimit value') + option('max-id-name-length', type: 'integer', min: 32, value: 256, + description: 'Max length of any "id" or "name" type field.') +diff --git a/src/metric.cpp b/src/metric.cpp +index d6b62d8..48fb7a7 100644 +--- a/src/metric.cpp ++++ b/src/metric.cpp +@@ -81,7 +81,7 @@ const std::vector<MetricValue>& Metric::getUpdatedReadings() + i = idx; + } + +- readings.emplace_back(id, sensors[i]->metadata(), *value, ++ readings.emplace_back(sensors[i]->metadata(), *value, + systemTimestamp); + } + } +diff --git a/src/metric_value.hpp b/src/metric_value.hpp +index d01ac4e..9dfc6ac 100644 +--- a/src/metric_value.hpp ++++ b/src/metric_value.hpp +@@ -5,7 +5,6 @@ + + struct MetricValue + { +- std::string id; + std::string metadata; + double value; + uint64_t timestamp; +diff --git a/src/report.cpp b/src/report.cpp +index 9ee60a4..624bdbc 100644 +--- a/src/report.cpp ++++ b/src/report.cpp +@@ -461,7 +461,7 @@ void Report::scheduleTimerForPeriodicReport(Milliseconds timerInterval) + + void Report::scheduleTimerForOnChangeReport() + { +- constexpr Milliseconds timerInterval{100}; ++ constexpr Milliseconds timerInterval{10000}; + + timer.expires_after(timerInterval); + timer.async_wait([this](boost::system::error_code ec) { +@@ -489,7 +489,7 @@ void Report::updateReadings() + break; + } + +- for (const auto& [id, metadata, value, timestamp] : ++ for (const auto& [metadata, value, timestamp] : + metric->getUpdatedReadings()) + { + if (reportUpdates == ReportUpdates::appendStopsWhenFull && +@@ -499,7 +499,7 @@ void Report::updateReadings() + reportIface->signal_property("Enabled"); + break; + } +- readingsBuffer.emplace(id, metadata, value, timestamp); ++ readingsBuffer.emplace(metadata, value, timestamp); + } + } + +diff --git a/src/types/readings.hpp b/src/types/readings.hpp +index 6749bbf..74566eb 100644 +--- a/src/types/readings.hpp ++++ b/src/types/readings.hpp +@@ -3,11 +3,11 @@ + #include "utils/labeled_tuple.hpp" + #include "utils/tstring.hpp" + +-using ReadingData = std::tuple<std::string, std::string, double, uint64_t>; ++using ReadingData = std::tuple<std::string, double, uint64_t>; + using Readings = std::tuple<uint64_t, std::vector<ReadingData>>; + + using LabeledReadingData = +- utils::LabeledTuple<ReadingData, utils::tstring::MetricId, ++ utils::LabeledTuple<ReadingData, + utils::tstring::MetricProperty, + utils::tstring::MetricValue, utils::tstring::Timestamp>; + +diff --git a/src/utils/dbus_path_utils.hpp b/src/utils/dbus_path_utils.hpp +index 3798d98..d0e1d24 100644 +--- a/src/utils/dbus_path_utils.hpp ++++ b/src/utils/dbus_path_utils.hpp +@@ -14,7 +14,7 @@ namespace constants + constexpr std::string_view triggerDirStr = + "/xyz/openbmc_project/Telemetry/Triggers/"; + constexpr std::string_view reportDirStr = +- "/xyz/openbmc_project/Telemetry/Reports/"; ++ "/xyz/openbmc_project/Telemetry/Reports/TelemetryService"; + + constexpr std::string_view allowedCharactersInPath = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_/"; diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0001-set_new_report_path.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0001-set_new_report_path.patch deleted file mode 100644 index b59438bd28..0000000000 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0001-set_new_report_path.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 71ad04dd8ce0a31fe260626215d30bf0e58b255c Mon Sep 17 00:00:00 2001 -From: eportnov <eportnov@ibs.ru> -Date: Fri, 15 Jul 2022 17:38:30 +0300 -Subject: [PATCH] set_new_report_path - ---- - src/report.hpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/report.hpp b/src/report.hpp -index 6d8c6b4..8d71bc9 100644 ---- a/src/report.hpp -+++ b/src/report.hpp -@@ -137,7 +137,7 @@ class Report : public interfaces::Report, public interfaces::MetricListener - static constexpr const char* reportIfaceName = - "xyz.openbmc_project.Telemetry.Report"; - static constexpr const char* reportDir = -- "/xyz/openbmc_project/Telemetry/Reports/"; -+ "/xyz/openbmc_project/Telemetry/Reports/TelemetryService/"; - static constexpr const char* deleteIfaceName = - "xyz.openbmc_project.Object.Delete"; - static constexpr size_t reportVersion = 6; diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0002-add-hour-data.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0002-add-hour-data.patch new file mode 100644 index 0000000000..3a795b1838 --- /dev/null +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0002-add-hour-data.patch @@ -0,0 +1,97 @@ +From 34ff94d5b3c8fae4050c96aaabc2975d158c85cf Mon Sep 17 00:00:00 2001 +From: eportnov <eportnov@ibs.ru> +Date: Thu, 8 Sep 2022 15:23:11 +0300 +Subject: [PATCH] add hour data + +--- + src/report.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++++++---- + src/report.hpp | 2 ++ + 2 files changed, 49 insertions(+), 4 deletions(-) + +diff --git a/src/report.cpp b/src/report.cpp +index 624bdbc..06985a5 100644 +--- a/src/report.cpp ++++ b/src/report.cpp +@@ -296,10 +296,6 @@ std::unique_ptr<sdbusplus::asio::dbus_interface> + return 1; + }, + [this](const auto&) { return persistency; }); +- +- dbusIface->register_property_r("Readings", readings, +- sdbusplus::vtable::property_::emits_change, +- [this](const auto&) { return readings; }); + dbusIface->register_property_rw<std::string>( + "ReportingType", sdbusplus::vtable::property_::emits_change, + [this](auto newVal, auto& oldVal) { +@@ -411,11 +407,58 @@ std::unique_ptr<sdbusplus::asio::dbus_interface> + updateReadings(); + } + }); ++ dbusIface->register_method("GetReadings", [this](bool is_need_last_hour) { ++ if(is_need_last_hour) ++ { ++ return getHourReadings(); ++ } ++ return readings; ++ }); + constexpr bool skipPropertiesChangedSignal = true; + dbusIface->initialize(skipPropertiesChangedSignal); + return dbusIface; + } + ++ Readings Report::getHourReadings() ++ { ++ static constexpr int ZERO_POSITION = 0; ++ ++ Readings result; ++ std::get<0>(result) = std::get<0>(readings); ++ auto& result_read = std::get<1>(result);; ++ ++ auto& read = std::get<1>(readings); ++ auto hour_pos = GetPositionOnLastHour(read); ++ ++ if(hour_pos == ZERO_POSITION) ++ { ++ return readings; ++ } ++ std::copy(read.begin() + hour_pos, read.end(), std::back_inserter(result_read)); ++ ++ return result; ++ } ++ ++ int Report::GetPositionOnLastHour(const std::vector<ReadingData>& readings) ++ { ++ static constexpr uint32_t SECONDS_IN_HOUR = 60*60; ++ static constexpr int DEFAULT_RESULT = 0; ++ ++ uint64_t time_past_hour = std::chrono::duration_cast<std::chrono::seconds>( ++ std::chrono::system_clock::now().time_since_epoch()).count() - SECONDS_IN_HOUR; ++ ++ ++ for(auto it = readings.rbegin(); it !=readings.rend(); ++it) ++ { ++ auto reading_time = std::get<2>(*it); ++ if(reading_time < time_past_hour) ++ { ++ return abs(readings.rend() - it); ++ } ++ } ++ return DEFAULT_RESULT; ++ } ++ + void Report::timerProcForPeriodicReport(boost::system::error_code ec, + Report& self) + { +diff --git a/src/report.hpp b/src/report.hpp +index 74c979b..b55b01b 100644 +--- a/src/report.hpp ++++ b/src/report.hpp +@@ -112,6 +112,8 @@ class Report : public interfaces::Report, public interfaces::MetricListener + void updateReadings(); + void scheduleTimer(); + std::vector<ErrorMessage> verify() const; ++ Readings getHourReadings(); ++ int GetPositionOnLastHour(const std::vector<ReadingData>& readings); + + std::string id; + const sdbusplus::message::object_path path; diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0002-configure-telemetry.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0002-configure-telemetry.patch deleted file mode 100644 index e59e6a5c1d..0000000000 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0002-configure-telemetry.patch +++ /dev/null @@ -1,1191 +0,0 @@ -From 749825187d79077161f63086141f8a7f25c7655b Mon Sep 17 00:00:00 2001 -From: eportnov <eportnov@ibs.ru> -Date: Fri, 5 Aug 2022 16:14:04 +0300 -Subject: [PATCH] configure telemetry - ---- - meson_options.txt | 2 +- - src/discrete_threshold.cpp | 10 ++--- - src/discrete_threshold.hpp | 10 ++--- - src/interfaces/clock.hpp | 4 +- - src/interfaces/metric.hpp | 2 +- - src/interfaces/report_factory.hpp | 2 +- - src/interfaces/sensor_listener.hpp | 2 +- - src/interfaces/trigger_action.hpp | 2 +- - src/metric.cpp | 8 ++-- - src/metric.hpp | 4 +- - src/metric_value.hpp | 3 +- - src/metrics/collection_data.cpp | 14 +++---- - src/metrics/collection_data.hpp | 4 +- - src/metrics/collection_function.cpp | 22 +++++----- - src/metrics/collection_function.hpp | 6 +-- - src/numeric_threshold.cpp | 10 ++--- - src/numeric_threshold.hpp | 10 ++--- - src/on_change_threshold.cpp | 4 +- - src/on_change_threshold.hpp | 4 +- - src/report.cpp | 64 ++++++++++++++++++++++++----- - src/report.hpp | 8 ++-- - src/report_factory.cpp | 4 +- - src/report_factory.hpp | 2 +- - src/report_manager.cpp | 12 +++--- - src/report_manager.hpp | 11 ++--- - src/sensor.hpp | 4 +- - src/trigger_actions.cpp | 16 ++++---- - src/trigger_actions.hpp | 14 +++---- - src/trigger_factory.cpp | 6 +-- - src/types/collection_duration.hpp | 4 +- - src/types/duration_types.hpp | 3 +- - src/types/readings.hpp | 8 ++-- - src/utils/clock.hpp | 8 ++-- - 33 files changed, 166 insertions(+), 121 deletions(-) - -diff --git a/meson_options.txt b/meson_options.txt -index 23ec2aa..d17bb1a 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -3,7 +3,7 @@ option('max-reports', type: 'integer', min: 1, value: 10, - description: 'Max number of Reports') - option('max-reading-parameters', type: 'integer', min: 1, value: 200, - description: 'Max number of metric properties in single report') --option('min-interval', type: 'integer', min: 1, value: 1000, -+option('min-interval', type: 'integer', min: 1, value: 10, - description: 'Minimal value of interval in milliseconds') - option('max-triggers', type: 'integer', min: 1, value: 10, - description: 'Max number of Triggers') -diff --git a/src/discrete_threshold.cpp b/src/discrete_threshold.cpp -index 1bb250f..e9c73d1 100644 ---- a/src/discrete_threshold.cpp -+++ b/src/discrete_threshold.cpp -@@ -7,7 +7,7 @@ - DiscreteThreshold::DiscreteThreshold( - boost::asio::io_context& ioc, Sensors sensorsIn, - std::vector<std::unique_ptr<interfaces::TriggerAction>> actionsIn, -- Milliseconds dwellTimeIn, const std::string& thresholdValueIn, -+ Seconds dwellTimeIn, const std::string& thresholdValueIn, - const std::string& nameIn, const discrete::Severity severityIn) : - ioc(ioc), - actions(std::move(actionsIn)), dwellTime(dwellTimeIn), -@@ -44,7 +44,7 @@ std::shared_ptr<DiscreteThreshold::ThresholdDetail> - } - - void DiscreteThreshold::sensorUpdated(interfaces::Sensor& sensor, -- Milliseconds timestamp, double value) -+ Seconds timestamp, double value) - { - auto& details = getDetails(sensor); - auto& [sensorName, dwell, timer] = details; -@@ -61,13 +61,13 @@ void DiscreteThreshold::sensorUpdated(interfaces::Sensor& sensor, - } - - void DiscreteThreshold::startTimer(DiscreteThreshold::ThresholdDetail& details, -- Milliseconds timestamp, double value) -+ Seconds timestamp, double value) - { - const auto& sensorName = details.sensorName; - auto& dwell = details.dwell; - auto& timer = details.timer; - -- if (dwellTime == Milliseconds::zero()) -+ if (dwellTime == Seconds::zero()) - { - commit(sensorName, timestamp, value); - } -@@ -90,7 +90,7 @@ void DiscreteThreshold::startTimer(DiscreteThreshold::ThresholdDetail& details, - } - - void DiscreteThreshold::commit(const std::string& sensorName, -- Milliseconds timestamp, double value) -+ Seconds timestamp, double value) - { - for (const auto& action : actions) - { -diff --git a/src/discrete_threshold.hpp b/src/discrete_threshold.hpp -index 545a980..9f049b5 100644 ---- a/src/discrete_threshold.hpp -+++ b/src/discrete_threshold.hpp -@@ -24,20 +24,20 @@ class DiscreteThreshold : - DiscreteThreshold( - boost::asio::io_context& ioc, Sensors sensors, - std::vector<std::unique_ptr<interfaces::TriggerAction>> actions, -- Milliseconds dwellTime, const std::string& thresholdValue, -+ Seconds dwellTime, const std::string& thresholdValue, - const std::string& name, const discrete::Severity severity); - DiscreteThreshold(const DiscreteThreshold&) = delete; - DiscreteThreshold(DiscreteThreshold&&) = delete; - - void initialize() override; -- void sensorUpdated(interfaces::Sensor&, Milliseconds, double) override; -+ void sensorUpdated(interfaces::Sensor&, Seconds, double) override; - LabeledThresholdParam getThresholdParam() const override; - void updateSensors(Sensors newSensors) override; - - private: - boost::asio::io_context& ioc; - const std::vector<std::unique_ptr<interfaces::TriggerAction>> actions; -- const Milliseconds dwellTime; -+ const Seconds dwellTime; - const std::string thresholdValue; - const double numericThresholdValue; - const std::string name; -@@ -63,8 +63,8 @@ class DiscreteThreshold : - - friend ThresholdOperations; - -- void startTimer(ThresholdDetail&, Milliseconds, double); -- void commit(const std::string&, Milliseconds, double); -+ void startTimer(ThresholdDetail&, Seconds, double); -+ void commit(const std::string&, Seconds, double); - ThresholdDetail& getDetails(const interfaces::Sensor& sensor); - std::shared_ptr<ThresholdDetail> makeDetails(const std::string& sensorName); - }; -diff --git a/src/interfaces/clock.hpp b/src/interfaces/clock.hpp -index b37ff3a..bb06569 100644 ---- a/src/interfaces/clock.hpp -+++ b/src/interfaces/clock.hpp -@@ -12,8 +12,8 @@ class Clock - public: - virtual ~Clock() = default; - -- virtual Milliseconds steadyTimestamp() const noexcept = 0; -- virtual Milliseconds systemTimestamp() const noexcept = 0; -+ virtual Seconds steadyTimestamp() const noexcept = 0; -+ virtual Seconds systemTimestamp() const noexcept = 0; - }; - - } // namespace interfaces -diff --git a/src/interfaces/metric.hpp b/src/interfaces/metric.hpp -index c52dd45..2a5f999 100644 ---- a/src/interfaces/metric.hpp -+++ b/src/interfaces/metric.hpp -@@ -25,7 +25,7 @@ class Metric - virtual void registerForUpdates(interfaces::MetricListener& listener) = 0; - virtual void - unregisterFromUpdates(interfaces::MetricListener& listener) = 0; -- virtual void updateReadings(Milliseconds) = 0; -+ virtual void updateReadings(Seconds) = 0; - virtual bool isTimerRequired() const = 0; - }; - -diff --git a/src/interfaces/report_factory.hpp b/src/interfaces/report_factory.hpp -index d8e076a..d58a15e 100644 ---- a/src/interfaces/report_factory.hpp -+++ b/src/interfaces/report_factory.hpp -@@ -39,7 +39,7 @@ class ReportFactory - make(const std::string& id, const std::string& name, - const ReportingType reportingType, - const std::vector<ReportAction>& reportActions, -- Milliseconds period, uint64_t appendLimit, -+ Seconds period, uint64_t appendLimit, - const ReportUpdates reportUpdates, ReportManager& reportManager, - JsonStorage& reportStorage, - std::vector<LabeledMetricParameters> labeledMetricParams, -diff --git a/src/interfaces/sensor_listener.hpp b/src/interfaces/sensor_listener.hpp -index 3f35c38..ed7b904 100644 ---- a/src/interfaces/sensor_listener.hpp -+++ b/src/interfaces/sensor_listener.hpp -@@ -15,7 +15,7 @@ class SensorListener - public: - virtual ~SensorListener() = default; - -- virtual void sensorUpdated(interfaces::Sensor&, Milliseconds, double) = 0; -+ virtual void sensorUpdated(interfaces::Sensor&, Seconds, double) = 0; - }; - - } // namespace interfaces -diff --git a/src/interfaces/trigger_action.hpp b/src/interfaces/trigger_action.hpp -index 437a79f..f7cdb92 100644 ---- a/src/interfaces/trigger_action.hpp -+++ b/src/interfaces/trigger_action.hpp -@@ -13,7 +13,7 @@ class TriggerAction - public: - virtual ~TriggerAction() = default; - -- virtual void commit(const std::string& id, Milliseconds timestamp, -+ virtual void commit(const std::string& id, Seconds timestamp, - double value) = 0; - }; - } // namespace interfaces -diff --git a/src/metric.cpp b/src/metric.cpp -index d6b62d8..b58f0c7 100644 ---- a/src/metric.cpp -+++ b/src/metric.cpp -@@ -58,7 +58,7 @@ const std::vector<MetricValue>& Metric::getUpdatedReadings() - { - const auto steadyTimestamp = clock->steadyTimestamp(); - const auto systemTimestamp = -- std::chrono::duration_cast<Milliseconds>(clock->systemTimestamp()) -+ std::chrono::duration_cast<Seconds>(clock->systemTimestamp()) - .count(); - - for (size_t i = 0; i < collectionAlgorithms.size(); ++i) -@@ -81,7 +81,7 @@ const std::vector<MetricValue>& Metric::getUpdatedReadings() - i = idx; - } - -- readings.emplace_back(id, sensors[i]->metadata(), *value, -+ readings.emplace_back(sensors[i]->metadata(), *value, - systemTimestamp); - } - } -@@ -90,7 +90,7 @@ const std::vector<MetricValue>& Metric::getUpdatedReadings() - return readings; - } - --void Metric::sensorUpdated(interfaces::Sensor& notifier, Milliseconds timestamp, -+void Metric::sensorUpdated(interfaces::Sensor& notifier, Seconds timestamp, - double value) - { - auto& data = findAssociatedData(notifier); -@@ -131,7 +131,7 @@ uint64_t Metric::sensorCount() const - return sensors.size(); - } - --void Metric::updateReadings(Milliseconds timestamp) -+void Metric::updateReadings(Seconds timestamp) - { - for (auto& data : collectionAlgorithms) - { -diff --git a/src/metric.hpp b/src/metric.hpp -index 8b367b3..197f9c5 100644 ---- a/src/metric.hpp -+++ b/src/metric.hpp -@@ -21,13 +21,13 @@ class Metric : - void initialize() override; - void deinitialize() override; - const std::vector<MetricValue>& getUpdatedReadings() override; -- void sensorUpdated(interfaces::Sensor&, Milliseconds, -+ void sensorUpdated(interfaces::Sensor&, Seconds, - double value) override; - LabeledMetricParameters dumpConfiguration() const override; - uint64_t sensorCount() const override; - void registerForUpdates(interfaces::MetricListener& listener) override; - void unregisterFromUpdates(interfaces::MetricListener& listener) override; -- void updateReadings(Milliseconds) override; -+ void updateReadings(Seconds) override; - bool isTimerRequired() const override; - - private: -diff --git a/src/metric_value.hpp b/src/metric_value.hpp -index d01ac4e..4073112 100644 ---- a/src/metric_value.hpp -+++ b/src/metric_value.hpp -@@ -5,8 +5,7 @@ - - struct MetricValue - { -- std::string id; - std::string metadata; - double value; -- uint64_t timestamp; -+ uint32_t timestamp; - }; -diff --git a/src/metrics/collection_data.cpp b/src/metrics/collection_data.cpp -index 9512252..445da08 100644 ---- a/src/metrics/collection_data.cpp -+++ b/src/metrics/collection_data.cpp -@@ -15,12 +15,12 @@ bool CollectionData::updateLastValue(double value) - class DataPoint : public CollectionData - { - public: -- std::optional<double> update(Milliseconds) override -+ std::optional<double> update(Seconds) override - { - return lastReading; - } - -- double update(Milliseconds, double reading) override -+ double update(Seconds, double reading) override - { - lastReading = reading; - return reading; -@@ -46,7 +46,7 @@ class DataInterval : public CollectionData - } - } - -- std::optional<double> update(Milliseconds timestamp) override -+ std::optional<double> update(Seconds timestamp) override - { - if (readings.empty()) - { -@@ -58,7 +58,7 @@ class DataInterval : public CollectionData - return function->calculate(readings, timestamp); - } - -- double update(Milliseconds timestamp, double reading) override -+ double update(Seconds timestamp, double reading) override - { - readings.emplace_back(timestamp, reading); - -@@ -68,7 +68,7 @@ class DataInterval : public CollectionData - } - - private: -- void cleanup(Milliseconds timestamp) -+ void cleanup(Seconds timestamp) - { - auto it = readings.begin(); - for (auto kt = std::next(readings.rbegin()); kt != readings.rend(); -@@ -103,7 +103,7 @@ class DataStartup : public CollectionData - function(std::move(function)) - {} - -- std::optional<double> update(Milliseconds timestamp) override -+ std::optional<double> update(Seconds timestamp) override - { - if (readings.empty()) - { -@@ -113,7 +113,7 @@ class DataStartup : public CollectionData - return function->calculateForStartupInterval(readings, timestamp); - } - -- double update(Milliseconds timestamp, double reading) override -+ double update(Seconds timestamp, double reading) override - { - readings.emplace_back(timestamp, reading); - return function->calculateForStartupInterval(readings, timestamp); -diff --git a/src/metrics/collection_data.hpp b/src/metrics/collection_data.hpp -index 251e704..1f14d76 100644 ---- a/src/metrics/collection_data.hpp -+++ b/src/metrics/collection_data.hpp -@@ -17,8 +17,8 @@ class CollectionData - public: - virtual ~CollectionData() = default; - -- virtual std::optional<double> update(Milliseconds timestamp) = 0; -- virtual double update(Milliseconds timestamp, double value) = 0; -+ virtual std::optional<double> update(Seconds timestamp) = 0; -+ virtual double update(Seconds timestamp, double value) = 0; - bool updateLastValue(double value); - - private: -diff --git a/src/metrics/collection_function.cpp b/src/metrics/collection_function.cpp -index 717bb68..6b21749 100644 ---- a/src/metrics/collection_function.cpp -+++ b/src/metrics/collection_function.cpp -@@ -9,7 +9,7 @@ class FunctionMinimum : public CollectionFunction - { - public: - double calculate(const std::vector<ReadingItem>& readings, -- Milliseconds) const override -+ Seconds) const override - { - return std::min_element( - readings.begin(), readings.end(), -@@ -23,7 +23,7 @@ class FunctionMinimum : public CollectionFunction - } - - double calculateForStartupInterval(std::vector<ReadingItem>& readings, -- Milliseconds timestamp) const override -+ Seconds timestamp) const override - { - readings.assign( - {ReadingItem(timestamp, calculate(readings, timestamp))}); -@@ -35,7 +35,7 @@ class FunctionMaximum : public CollectionFunction - { - public: - double calculate(const std::vector<ReadingItem>& readings, -- Milliseconds) const override -+ Seconds) const override - { - return std::max_element( - readings.begin(), readings.end(), -@@ -49,7 +49,7 @@ class FunctionMaximum : public CollectionFunction - } - - double calculateForStartupInterval(std::vector<ReadingItem>& readings, -- Milliseconds timestamp) const override -+ Seconds timestamp) const override - { - readings.assign( - {ReadingItem(timestamp, calculate(readings, timestamp))}); -@@ -61,10 +61,10 @@ class FunctionAverage : public CollectionFunction - { - public: - double calculate(const std::vector<ReadingItem>& readings, -- Milliseconds timestamp) const override -+ Seconds timestamp) const override - { - auto valueSum = 0.0; -- auto timeSum = Milliseconds{0}; -+ auto timeSum = Seconds{0}; - for (auto it = readings.begin(); it != std::prev(readings.end()); ++it) - { - if (std::isfinite(it->second)) -@@ -80,11 +80,11 @@ class FunctionAverage : public CollectionFunction - valueSum += readings.back().second * duration.count(); - timeSum += duration; - -- return valueSum / std::max(timeSum.count(), uint64_t{1u}); -+ return valueSum / std::max(timeSum.count(), uint32_t{1u}); - } - - double calculateForStartupInterval(std::vector<ReadingItem>& readings, -- Milliseconds timestamp) const override -+ Seconds timestamp) const override - { - auto result = calculate(readings, timestamp); - if (std::isfinite(result)) -@@ -102,7 +102,7 @@ class FunctionSummation : public CollectionFunction - - public: - double calculate(const std::vector<ReadingItem>& readings, -- const Milliseconds timestamp) const override -+ const Seconds timestamp) const override - { - auto valueSum = 0.0; - for (auto it = readings.begin(); it != std::prev(readings.end()); ++it) -@@ -125,7 +125,7 @@ class FunctionSummation : public CollectionFunction - - double - calculateForStartupInterval(std::vector<ReadingItem>& readings, -- const Milliseconds timestamp) const override -+ const Seconds timestamp) const override - { - const auto result = calculate(readings, timestamp); - if (readings.size() > 2 && std::isfinite(result)) -@@ -144,7 +144,7 @@ class FunctionSummation : public CollectionFunction - } - - private: -- static constexpr Multiplier calculateMultiplier(Milliseconds duration) -+ static constexpr Multiplier calculateMultiplier(Seconds duration) - { - constexpr auto m = Multiplier{Seconds{1}}; - return Multiplier{duration / m}; -diff --git a/src/metrics/collection_function.hpp b/src/metrics/collection_function.hpp -index 610f015..58ff5d0 100644 ---- a/src/metrics/collection_function.hpp -+++ b/src/metrics/collection_function.hpp -@@ -11,7 +11,7 @@ - namespace metrics - { - --using ReadingItem = std::pair<Milliseconds, double>; -+using ReadingItem = std::pair<Seconds, double>; - - class CollectionFunction - { -@@ -19,10 +19,10 @@ class CollectionFunction - virtual ~CollectionFunction() = default; - - virtual double calculate(const std::vector<ReadingItem>& readings, -- Milliseconds timestamp) const = 0; -+ Seconds timestamp) const = 0; - virtual double - calculateForStartupInterval(std::vector<ReadingItem>& readings, -- Milliseconds timestamp) const = 0; -+ Seconds timestamp) const = 0; - }; - - std::shared_ptr<CollectionFunction> makeCollectionFunction(OperationType); -diff --git a/src/numeric_threshold.cpp b/src/numeric_threshold.cpp -index cb6dbdd..4c71cfb 100644 ---- a/src/numeric_threshold.cpp -+++ b/src/numeric_threshold.cpp -@@ -5,7 +5,7 @@ - NumericThreshold::NumericThreshold( - boost::asio::io_context& ioc, Sensors sensorsIn, - std::vector<std::unique_ptr<interfaces::TriggerAction>> actionsIn, -- Milliseconds dwellTimeIn, numeric::Direction directionIn, -+ Seconds dwellTimeIn, numeric::Direction directionIn, - double thresholdValueIn, numeric::Type typeIn) : - ioc(ioc), - actions(std::move(actionsIn)), dwellTime(dwellTimeIn), -@@ -41,7 +41,7 @@ std::shared_ptr<NumericThreshold::ThresholdDetail> - } - - void NumericThreshold::sensorUpdated(interfaces::Sensor& sensor, -- Milliseconds timestamp, double value) -+ Seconds timestamp, double value) - { - auto& details = getDetails(sensor); - auto& [sensorName, prevValue, dwell, timer] = details; -@@ -64,13 +64,13 @@ void NumericThreshold::sensorUpdated(interfaces::Sensor& sensor, - } - - void NumericThreshold::startTimer(NumericThreshold::ThresholdDetail& details, -- Milliseconds timestamp, double value) -+ Seconds timestamp, double value) - { - const auto& sensorName = details.sensorName; - auto& dwell = details.dwell; - auto& timer = details.timer; - -- if (dwellTime == Milliseconds::zero()) -+ if (dwellTime == Seconds::zero()) - { - commit(sensorName, timestamp, value); - } -@@ -93,7 +93,7 @@ void NumericThreshold::startTimer(NumericThreshold::ThresholdDetail& details, - } - - void NumericThreshold::commit(const std::string& sensorName, -- Milliseconds timestamp, double value) -+ Seconds timestamp, double value) - { - for (const auto& action : actions) - { -diff --git a/src/numeric_threshold.hpp b/src/numeric_threshold.hpp -index ecf3d6a..8f55af8 100644 ---- a/src/numeric_threshold.hpp -+++ b/src/numeric_threshold.hpp -@@ -24,20 +24,20 @@ class NumericThreshold : - NumericThreshold( - boost::asio::io_context& ioc, Sensors sensors, - std::vector<std::unique_ptr<interfaces::TriggerAction>> actions, -- Milliseconds dwellTime, numeric::Direction direction, -+ Seconds dwellTime, numeric::Direction direction, - double thresholdValue, numeric::Type type); - ~NumericThreshold() - {} - - void initialize() override; -- void sensorUpdated(interfaces::Sensor&, Milliseconds, double) override; -+ void sensorUpdated(interfaces::Sensor&, Seconds, double) override; - LabeledThresholdParam getThresholdParam() const override; - void updateSensors(Sensors newSensors) override; - - private: - boost::asio::io_context& ioc; - const std::vector<std::unique_ptr<interfaces::TriggerAction>> actions; -- const Milliseconds dwellTime; -+ const Seconds dwellTime; - const numeric::Direction direction; - const double thresholdValue; - const numeric::Type type; -@@ -63,8 +63,8 @@ class NumericThreshold : - - friend ThresholdOperations; - -- void startTimer(ThresholdDetail&, Milliseconds, double); -- void commit(const std::string&, Milliseconds, double); -+ void startTimer(ThresholdDetail&, Seconds, double); -+ void commit(const std::string&, Seconds, double); - ThresholdDetail& getDetails(const interfaces::Sensor& sensor); - std::shared_ptr<ThresholdDetail> makeDetails(const std::string& sensorName); - }; -diff --git a/src/on_change_threshold.cpp b/src/on_change_threshold.cpp -index eea8978..b0338e0 100644 ---- a/src/on_change_threshold.cpp -+++ b/src/on_change_threshold.cpp -@@ -51,7 +51,7 @@ void OnChangeThreshold::updateSensors(Sensors newSensors) - } - - void OnChangeThreshold::sensorUpdated(interfaces::Sensor& sensor, -- Milliseconds timestamp, double value) -+ Seconds timestamp, double value) - { - if (isFirstReading) - { -@@ -63,7 +63,7 @@ void OnChangeThreshold::sensorUpdated(interfaces::Sensor& sensor, - } - - void OnChangeThreshold::commit(const std::string& sensorName, -- Milliseconds timestamp, double value) -+ Seconds timestamp, double value) - { - for (const auto& action : actions) - { -diff --git a/src/on_change_threshold.hpp b/src/on_change_threshold.hpp -index 1d4a4d0..fb60896 100644 ---- a/src/on_change_threshold.hpp -+++ b/src/on_change_threshold.hpp -@@ -25,7 +25,7 @@ class OnChangeThreshold : - {} - - void initialize() override; -- void sensorUpdated(interfaces::Sensor&, Milliseconds, double) override; -+ void sensorUpdated(interfaces::Sensor&, Seconds, double) override; - LabeledThresholdParam getThresholdParam() const override; - void updateSensors(Sensors newSensors) override; - -@@ -35,5 +35,5 @@ class OnChangeThreshold : - bool initialized = false; - bool isFirstReading = true; - -- void commit(const std::string&, Milliseconds, double); -+ void commit(const std::string&, Seconds, double); - }; -diff --git a/src/report.cpp b/src/report.cpp -index 540418a..a53f287 100644 ---- a/src/report.cpp -+++ b/src/report.cpp -@@ -21,7 +21,7 @@ Report::Report(boost::asio::io_context& ioc, - const std::string& reportId, const std::string& reportName, - const ReportingType reportingTypeIn, - std::vector<ReportAction> reportActionsIn, -- const Milliseconds intervalIn, const uint64_t appendLimitIn, -+ const Seconds intervalIn, const uint64_t appendLimitIn, - const ReportUpdates reportUpdatesIn, - interfaces::ReportManager& reportManager, - interfaces::JsonStorage& reportStorageIn, -@@ -234,7 +234,7 @@ std::unique_ptr<sdbusplus::asio::dbus_interface> - "Interval", interval.count(), - sdbusplus::vtable::property_::emits_change, - [this](uint64_t newVal, auto&) { -- if (Milliseconds newValT{newVal}; -+ if (Seconds newValT{newVal}; - newValT >= ReportManager::minInterval) - { - if (newValT != interval) -@@ -269,9 +269,6 @@ std::unique_ptr<sdbusplus::asio::dbus_interface> - }, - [this](const auto&) { return persistency; }); - -- dbusIface->register_property_r("Readings", readings, -- sdbusplus::vtable::property_::emits_change, -- [this](const auto&) { return readings; }); - dbusIface->register_property_rw( - "ReportingType", std::string(), - sdbusplus::vtable::property_::emits_change, -@@ -378,11 +375,58 @@ std::unique_ptr<sdbusplus::asio::dbus_interface> - updateReadings(); - } - }); -+ dbusIface->register_method("GetReadings", [this](bool is_need_last_hour) { -+ if(is_need_last_hour) -+ { -+ return getHourReadings(); -+ } -+ return readings; -+ }); - constexpr bool skipPropertiesChangedSignal = true; - dbusIface->initialize(skipPropertiesChangedSignal); - return dbusIface; - } - -+Readings Report::getHourReadings() -+{ -+ static constexpr int ZERO_POSITION = 0; -+ -+ Readings result; -+ std::get<0>(result) = std::get<0>(readings); -+ auto& result_read = std::get<1>(result);; -+ -+ auto& read = std::get<1>(readings); -+ auto hour_pos = GetPositionOnLastHour(read); -+ -+ if(hour_pos == ZERO_POSITION) -+ { -+ return readings; -+ } -+ std::copy(read.begin() + hour_pos, read.end(), std::back_inserter(result_read)); -+ -+ return result; -+} -+ -+int Report::GetPositionOnLastHour(const std::vector<ReadingData>& readings) -+{ -+ static constexpr uint32_t SECONDS_IN_HOUR = 60*60; -+ static constexpr int DEFAULT_RESULT = 0; -+ -+ uint64_t time_past_hour = std::chrono::duration_cast<std::chrono::seconds>( -+ std::chrono::system_clock::now().time_since_epoch()).count() - SECONDS_IN_HOUR; -+ -+ -+ for(auto it = readings.rbegin(); it !=readings.rend(); ++it) -+ { -+ auto reading_time = std::get<2>(*it); -+ if(reading_time < time_past_hour) -+ { -+ return abs(readings.rend() - it); -+ } -+ } -+ return DEFAULT_RESULT; -+} -+ - void Report::timerProcForPeriodicReport(boost::system::error_code ec, - Report& self) - { -@@ -418,7 +462,7 @@ void Report::timerProcForOnChangeReport(boost::system::error_code ec, - self.scheduleTimerForOnChangeReport(); - } - --void Report::scheduleTimerForPeriodicReport(Milliseconds timerInterval) -+void Report::scheduleTimerForPeriodicReport(Seconds timerInterval) - { - if (!enabled) - { -@@ -438,7 +482,7 @@ void Report::scheduleTimerForOnChangeReport() - return; - } - -- constexpr Milliseconds timerInterval{100}; -+ constexpr Seconds timerInterval{10}; - - timer.expires_after(timerInterval); - timer.async_wait([this](boost::system::error_code ec) { -@@ -461,7 +505,7 @@ void Report::updateReadings() - - for (const auto& metric : metrics) - { -- for (const auto& [id, metadata, value, timestamp] : -+ for (const auto& [metadata, value, timestamp] : - metric->getUpdatedReadings()) - { - if (reportUpdates == ReportUpdates::appendStopsWhenFull && -@@ -474,12 +518,12 @@ void Report::updateReadings() - } - break; - } -- readingsBuffer.emplace(id, metadata, value, timestamp); -+ readingsBuffer.emplace(metadata, value, timestamp); - } - } - - std::get<0>(readings) = -- std::chrono::duration_cast<Milliseconds>(clock->systemTimestamp()) -+ std::chrono::duration_cast<Seconds>(clock->systemTimestamp()) - .count(); - - if (utils::contains(reportActions, ReportAction::emitsReadingsUpdate)) -diff --git a/src/report.hpp b/src/report.hpp -index 8d71bc9..5353ce5 100644 ---- a/src/report.hpp -+++ b/src/report.hpp -@@ -55,7 +55,7 @@ class Report : public interfaces::Report, public interfaces::MetricListener - const std::shared_ptr<sdbusplus::asio::object_server>& objServer, - const std::string& reportId, const std::string& reportName, - const ReportingType reportingType, -- std::vector<ReportAction> reportActions, const Milliseconds period, -+ std::vector<ReportAction> reportActions, const Seconds period, - const uint64_t appendLimitIn, const ReportUpdates reportUpdatesIn, - interfaces::ReportManager& reportManager, - interfaces::JsonStorage& reportStorage, -@@ -88,7 +88,7 @@ class Report : public interfaces::Report, public interfaces::MetricListener - Report& self); - static void timerProcForOnChangeReport(boost::system::error_code, - Report& self); -- void scheduleTimerForPeriodicReport(Milliseconds interval); -+ void scheduleTimerForPeriodicReport(Seconds interval); - void scheduleTimerForOnChangeReport(); - std::optional<uint64_t> - deduceAppendLimit(const uint64_t appendLimitIn) const; -@@ -105,11 +105,13 @@ class Report : public interfaces::Report, public interfaces::MetricListener - bool shouldStoreMetricValues() const; - void updateReadings(); - void updateReportingType(ReportingType); -+ Readings getHourReadings(); -+ int GetPositionOnLastHour(const std::vector<ReadingData>& readings); - - std::string id; - std::string name; - ReportingType reportingType; -- Milliseconds interval; -+ Seconds interval; - std::unordered_set<ReportAction> reportActions; - ReadingParametersPastVersion readingParametersPastVersion; - ReadingParameters readingParameters; -diff --git a/src/report_factory.cpp b/src/report_factory.cpp -index 1c530f3..0d5a8d5 100644 ---- a/src/report_factory.cpp -+++ b/src/report_factory.cpp -@@ -19,7 +19,7 @@ ReportFactory::ReportFactory( - std::unique_ptr<interfaces::Report> ReportFactory::make( - const std::string& id, const std::string& name, - const ReportingType reportingType, -- const std::vector<ReportAction>& reportActions, Milliseconds period, -+ const std::vector<ReportAction>& reportActions, Seconds period, - uint64_t appendLimit, const ReportUpdates reportUpdates, - interfaces::ReportManager& reportManager, - interfaces::JsonStorage& reportStorage, -@@ -185,6 +185,6 @@ std::vector<LabeledMetricParameters> - return LabeledMetricParameters( - std::move(sensorParameters), utils::toOperationType(operationType), - id, utils::toCollectionTimeScope(collectionTimeScope), -- CollectionDuration(Milliseconds(collectionDuration))); -+ CollectionDuration(Seconds(collectionDuration))); - }); - } -diff --git a/src/report_factory.hpp b/src/report_factory.hpp -index e8729b1..8341970 100644 ---- a/src/report_factory.hpp -+++ b/src/report_factory.hpp -@@ -33,7 +33,7 @@ class ReportFactory : public interfaces::ReportFactory - make(const std::string& reportId, const std::string& name, - const ReportingType reportingType, - const std::vector<ReportAction>& reportActions, -- Milliseconds period, uint64_t appendLimitIn, -+ Seconds period, uint64_t appendLimitIn, - const ReportUpdates reportUpdatesIn, - interfaces::ReportManager& reportManager, - interfaces::JsonStorage& reportStorage, -diff --git a/src/report_manager.cpp b/src/report_manager.cpp -index 926b642..f7c266f 100644 ---- a/src/report_manager.cpp -+++ b/src/report_manager.cpp -@@ -90,7 +90,7 @@ ReportManager::ReportManager( - - return addReport(yield, reportId, reportId, - utils::toReportingType(reportingType), -- reportActions, Milliseconds(interval), -+ reportActions, Seconds(interval), - appendLimitDefault, reportUpdatesDefault, - convertToReadingParameters( - std::move(metricParams)), -@@ -117,7 +117,7 @@ ReportManager::ReportManager( - return utils::toReportAction( - reportAction); - }), -- Milliseconds(interval), appendLimit, -+ Seconds(interval), appendLimit, - utils::toReportUpdates(reportUpdates), - std::move(metricParams), enabledDefault) - .getPath(); -@@ -135,7 +135,7 @@ void ReportManager::removeReport(const interfaces::Report* report) - - void ReportManager::verifyAddReport( - const std::string& reportId, const std::string& reportName, -- const ReportingType reportingType, Milliseconds interval, -+ const ReportingType reportingType, Seconds interval, - const ReportUpdates reportUpdates, const uint64_t appendLimit, - const std::vector<LabeledMetricParameters>& readingParams) - { -@@ -196,7 +196,7 @@ void ReportManager::verifyAddReport( - interfaces::Report& ReportManager::addReport( - boost::asio::yield_context& yield, const std::string& reportId, - const std::string& reportName, const ReportingType reportingType, -- const std::vector<ReportAction>& reportActions, Milliseconds interval, -+ const std::vector<ReportAction>& reportActions, Seconds interval, - const uint64_t appendLimit, const ReportUpdates reportUpdates, - ReadingParameters metricParams, const bool enabled) - { -@@ -211,7 +211,7 @@ interfaces::Report& ReportManager::addReport( - interfaces::Report& ReportManager::addReport( - const std::string& reportId, const std::string& reportName, - const ReportingType reportingType, -- const std::vector<ReportAction>& reportActions, Milliseconds interval, -+ const std::vector<ReportAction>& reportActions, Seconds interval, - const uint64_t appendLimit, const ReportUpdates reportUpdates, - std::vector<LabeledMetricParameters> labeledMetricParams, - const bool enabled, Readings readings) -@@ -273,7 +273,7 @@ void ReportManager::loadFromPersistent() - } - - addReport(id, name, utils::toReportingType(reportingType), -- reportActions, Milliseconds(interval), appendLimit, -+ reportActions, Seconds(interval), appendLimit, - utils::toReportUpdates(reportUpdates), - std::move(readingParameters), enabled, - std::move(readings)); -diff --git a/src/report_manager.hpp b/src/report_manager.hpp -index d5653b2..dd029af 100644 ---- a/src/report_manager.hpp -+++ b/src/report_manager.hpp -@@ -15,6 +15,7 @@ - #include <memory> - #include <string> - #include <vector> -+#include <limits> - - class ReportManager : public interfaces::ReportManager - { -@@ -41,20 +42,20 @@ class ReportManager : public interfaces::ReportManager - - void verifyAddReport( - const std::string& reportId, const std::string& reportName, -- const ReportingType reportingType, Milliseconds interval, -+ const ReportingType reportingType, Seconds interval, - const ReportUpdates reportUpdates, const uint64_t appendLimit, - const std::vector<LabeledMetricParameters>& readingParams); - interfaces::Report& addReport( - boost::asio::yield_context& yield, const std::string& reportId, - const std::string& reportName, const ReportingType reportingType, -- const std::vector<ReportAction>& reportActions, Milliseconds interval, -+ const std::vector<ReportAction>& reportActions, Seconds interval, - const uint64_t appendLimit, const ReportUpdates reportUpdates, - ReadingParameters metricParams, const bool enabled); - interfaces::Report& - addReport(const std::string& reportId, const std::string& reportName, - const ReportingType reportingType, - const std::vector<ReportAction>& reportActions, -- Milliseconds interval, const uint64_t appendLimit, -+ Seconds interval, const uint64_t appendLimit, - const ReportUpdates reportUpdates, - std::vector<LabeledMetricParameters> metricParams, - const bool enabled, Readings); -@@ -66,8 +67,8 @@ class ReportManager : public interfaces::ReportManager - static constexpr size_t maxReportIdLength{ - TELEMETRY_MAX_DBUS_PATH_LENGTH - - std::string_view(Report::reportDir).length()}; -- static constexpr Milliseconds minInterval{TELEMETRY_MIN_INTERVAL}; -- static constexpr size_t maxAppendLimit{TELEMETRY_MAX_APPEND_LIMIT}; -+ static constexpr Seconds minInterval{TELEMETRY_MIN_INTERVAL}; -+ static constexpr uint64_t maxAppendLimit{std::numeric_limits<uint64_t>::max()}; - static constexpr const char* reportManagerIfaceName = - "xyz.openbmc_project.Telemetry.ReportManager"; - static constexpr const char* reportManagerPath = -diff --git a/src/sensor.hpp b/src/sensor.hpp -index 92ff02c..e4d2396 100644 ---- a/src/sensor.hpp -+++ b/src/sensor.hpp -@@ -51,12 +51,12 @@ class Sensor final : - std::string sensorMetadata; - boost::asio::io_context& ioc; - std::shared_ptr<sdbusplus::asio::connection> bus; -- Milliseconds timerInterval = Milliseconds(0); -+ Seconds timerInterval = Seconds(0); - std::optional<boost::asio::high_resolution_timer> timer; - - utils::UniqueCall uniqueCall; - std::vector<std::weak_ptr<interfaces::SensorListener>> listeners; -- Milliseconds timestamp = Milliseconds{0u}; -+ Seconds timestamp = Seconds{0u}; - std::optional<double> value; - std::unique_ptr<sdbusplus::bus::match_t> signalMonitor; - }; -diff --git a/src/trigger_actions.cpp b/src/trigger_actions.cpp -index c840422..06cb419 100644 ---- a/src/trigger_actions.cpp -+++ b/src/trigger_actions.cpp -@@ -13,7 +13,7 @@ namespace action - - namespace - { --std::string timestampToString(Milliseconds timestamp) -+std::string timestampToString(Seconds timestamp) - { - std::time_t t = static_cast<time_t>(timestamp.count()); - std::array<char, sizeof("YYYY-MM-DDThh:mm:ssZ")> buf = {}; -@@ -43,7 +43,7 @@ static const char* getDirection(double value, double threshold) - throw std::runtime_error("Invalid value"); - } - --void LogToJournal::commit(const std::string& sensorName, Milliseconds timestamp, -+void LogToJournal::commit(const std::string& sensorName, Seconds timestamp, - double value) - { - std::string msg = ::numeric::typeToString(type) + -@@ -72,7 +72,7 @@ const char* LogToRedfish::getMessageId() const - throw std::runtime_error("Invalid type"); - } - --void LogToRedfish::commit(const std::string& sensorName, Milliseconds timestamp, -+void LogToRedfish::commit(const std::string& sensorName, Seconds timestamp, - double value) - { - phosphor::logging::log<phosphor::logging::level::INFO>( -@@ -120,7 +120,7 @@ void fillActions( - - namespace discrete - { --void LogToJournal::commit(const std::string& sensorName, Milliseconds timestamp, -+void LogToJournal::commit(const std::string& sensorName, Seconds timestamp, - double value) - { - std::string msg = ::discrete::severityToString(severity) + -@@ -145,7 +145,7 @@ const char* LogToRedfish::getMessageId() const - throw std::runtime_error("Invalid severity"); - } - --void LogToRedfish::commit(const std::string& sensorName, Milliseconds timestamp, -+void LogToRedfish::commit(const std::string& sensorName, Seconds timestamp, - double value) - { - phosphor::logging::log<phosphor::logging::level::INFO>( -@@ -190,7 +190,7 @@ void fillActions( - - namespace onChange - { --void LogToJournal::commit(const std::string& sensorName, Milliseconds timestamp, -+void LogToJournal::commit(const std::string& sensorName, Seconds timestamp, - double value) - { - std::string msg = "Value changed on sensor " + sensorName + -@@ -200,7 +200,7 @@ void LogToJournal::commit(const std::string& sensorName, Milliseconds timestamp, - phosphor::logging::log<phosphor::logging::level::INFO>(msg.c_str()); - } - --void LogToRedfish::commit(const std::string& sensorName, Milliseconds timestamp, -+void LogToRedfish::commit(const std::string& sensorName, Seconds timestamp, - double value) - { - const char* messageId = "OpenBMC.0.1.0.DiscreteThresholdOnChange"; -@@ -243,7 +243,7 @@ void fillActions( - } // namespace onChange - } // namespace discrete - --void UpdateReport::commit(const std::string&, Milliseconds, double) -+void UpdateReport::commit(const std::string&, Seconds, double) - { - if (reportIds->empty()) - { -diff --git a/src/trigger_actions.hpp b/src/trigger_actions.hpp -index fdf07fe..c027c1d 100644 ---- a/src/trigger_actions.hpp -+++ b/src/trigger_actions.hpp -@@ -16,7 +16,7 @@ class LogToJournal : public interfaces::TriggerAction - LogToJournal(::numeric::Type type, double val) : type(type), threshold(val) - {} - -- void commit(const std::string& id, Milliseconds timestamp, -+ void commit(const std::string& id, Seconds timestamp, - double value) override; - - private: -@@ -30,7 +30,7 @@ class LogToRedfish : public interfaces::TriggerAction - LogToRedfish(::numeric::Type type, double val) : type(type), threshold(val) - {} - -- void commit(const std::string& id, Milliseconds timestamp, -+ void commit(const std::string& id, Seconds timestamp, - double value) override; - - private: -@@ -55,7 +55,7 @@ class LogToJournal : public interfaces::TriggerAction - explicit LogToJournal(::discrete::Severity severity) : severity(severity) - {} - -- void commit(const std::string& id, Milliseconds timestamp, -+ void commit(const std::string& id, Seconds timestamp, - double value) override; - - private: -@@ -68,7 +68,7 @@ class LogToRedfish : public interfaces::TriggerAction - explicit LogToRedfish(::discrete::Severity severity) : severity(severity) - {} - -- void commit(const std::string& id, Milliseconds timestamp, -+ void commit(const std::string& id, Seconds timestamp, - double value) override; - - private: -@@ -91,7 +91,7 @@ class LogToJournal : public interfaces::TriggerAction - LogToJournal() - {} - -- void commit(const std::string& id, Milliseconds timestamp, -+ void commit(const std::string& id, Seconds timestamp, - double value) override; - }; - -@@ -101,7 +101,7 @@ class LogToRedfish : public interfaces::TriggerAction - LogToRedfish() - {} - -- void commit(const std::string& id, Milliseconds timestamp, -+ void commit(const std::string& id, Seconds timestamp, - double value) override; - }; - -@@ -122,7 +122,7 @@ class UpdateReport : public interfaces::TriggerAction - reportIds(std::move(ids)) - {} - -- void commit(const std::string& id, Milliseconds timestamp, -+ void commit(const std::string& id, Seconds timestamp, - double value) override; - - private: -diff --git a/src/trigger_factory.cpp b/src/trigger_factory.cpp -index 6c9ceb9..d51e44c 100644 ---- a/src/trigger_factory.cpp -+++ b/src/trigger_factory.cpp -@@ -154,7 +154,7 @@ void TriggerFactory::makeDiscreteThreshold( - - std::string thresholdName = thresholdParam.at_label<ts::UserId>(); - discrete::Severity severity = thresholdParam.at_label<ts::Severity>(); -- auto dwellTime = Milliseconds(thresholdParam.at_label<ts::DwellTime>()); -+ auto dwellTime = Seconds(thresholdParam.at_label<ts::DwellTime>()); - std::string thresholdValue = thresholdParam.at_label<ts::ThresholdValue>(); - - action::discrete::fillActions(actions, triggerActions, severity, -@@ -162,7 +162,7 @@ void TriggerFactory::makeDiscreteThreshold( - - thresholds.emplace_back(std::make_shared<DiscreteThreshold>( - bus->get_io_context(), sensors, std::move(actions), -- Milliseconds(dwellTime), thresholdValue, thresholdName, severity)); -+ Seconds(dwellTime), thresholdValue, thresholdName, severity)); - } - - void TriggerFactory::makeNumericThreshold( -@@ -175,7 +175,7 @@ void TriggerFactory::makeNumericThreshold( - std::vector<std::unique_ptr<interfaces::TriggerAction>> actions; - - auto type = thresholdParam.at_label<ts::Type>(); -- auto dwellTime = Milliseconds(thresholdParam.at_label<ts::DwellTime>()); -+ auto dwellTime = Seconds(thresholdParam.at_label<ts::DwellTime>()); - auto direction = thresholdParam.at_label<ts::Direction>(); - auto thresholdValue = double{thresholdParam.at_label<ts::ThresholdValue>()}; - -diff --git a/src/types/collection_duration.hpp b/src/types/collection_duration.hpp -index cdb9ff9..4d569e5 100644 ---- a/src/types/collection_duration.hpp -+++ b/src/types/collection_duration.hpp -@@ -8,7 +8,7 @@ - #include <chrono> - #include <cstdint> - --BOOST_STRONG_TYPEDEF(Milliseconds, CollectionDuration) -+BOOST_STRONG_TYPEDEF(Seconds, CollectionDuration) - - inline void to_json(nlohmann::json& json, const CollectionDuration& value) - { -@@ -17,5 +17,5 @@ inline void to_json(nlohmann::json& json, const CollectionDuration& value) - - inline void from_json(const nlohmann::json& json, CollectionDuration& value) - { -- value = CollectionDuration(Milliseconds(json.get<uint64_t>())); -+ value = CollectionDuration(Seconds(json.get<uint64_t>())); - } -diff --git a/src/types/duration_types.hpp b/src/types/duration_types.hpp -index b65f779..76c960b 100644 ---- a/src/types/duration_types.hpp -+++ b/src/types/duration_types.hpp -@@ -2,5 +2,4 @@ - - #include <chrono> - --using Seconds = std::chrono::duration<uint64_t>; --using Milliseconds = std::chrono::duration<uint64_t, std::milli>; -+using Seconds = std::chrono::duration<uint32_t>; -diff --git a/src/types/readings.hpp b/src/types/readings.hpp -index 6749bbf..ec419ec 100644 ---- a/src/types/readings.hpp -+++ b/src/types/readings.hpp -@@ -3,16 +3,16 @@ - #include "utils/labeled_tuple.hpp" - #include "utils/tstring.hpp" - --using ReadingData = std::tuple<std::string, std::string, double, uint64_t>; --using Readings = std::tuple<uint64_t, std::vector<ReadingData>>; -+using ReadingData = std::tuple<std::string, double, uint32_t>; -+using Readings = std::tuple<uint32_t, std::vector<ReadingData>>; - - using LabeledReadingData = -- utils::LabeledTuple<ReadingData, utils::tstring::MetricId, -+ utils::LabeledTuple<ReadingData, - utils::tstring::MetricProperty, - utils::tstring::MetricValue, utils::tstring::Timestamp>; - - using LabeledReadings = -- utils::LabeledTuple<std::tuple<uint64_t, std::vector<LabeledReadingData>>, -+ utils::LabeledTuple<std::tuple<uint32_t, std::vector<LabeledReadingData>>, - utils::tstring::Timestamp, utils::tstring::Readings>; - - namespace utils -diff --git a/src/utils/clock.hpp b/src/utils/clock.hpp -index 4e17952..45c1bc4 100644 ---- a/src/utils/clock.hpp -+++ b/src/utils/clock.hpp -@@ -8,16 +8,16 @@ - class Clock : public interfaces::Clock - { - public: -- Milliseconds steadyTimestamp() const noexcept override -+ Seconds steadyTimestamp() const noexcept override - { -- return std::chrono::time_point_cast<Milliseconds>( -+ return std::chrono::time_point_cast<Seconds>( - std::chrono::steady_clock::now()) - .time_since_epoch(); - } - -- Milliseconds systemTimestamp() const noexcept override -+ Seconds systemTimestamp() const noexcept override - { -- return std::chrono::time_point_cast<Milliseconds>( -+ return std::chrono::time_point_cast<Seconds>( - std::chrono::system_clock::now()) - .time_since_epoch(); - } diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0003-bugfix-circular-buffer.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0003-bugfix-circular-buffer.patch new file mode 100644 index 0000000000..659a74e12e --- /dev/null +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0003-bugfix-circular-buffer.patch @@ -0,0 +1,200 @@ +From a5b67b01133090b3f498a46debefc0a2b34f1934 Mon Sep 17 00:00:00 2001 +From: eportnov <eportnov@ibs.ru> +Date: Thu, 8 Sep 2022 17:38:27 +0300 +Subject: [PATCH] bugfix circular buffer + +--- + src/report.cpp | 34 ++++++++----------------- + src/report.hpp | 8 +++--- + src/types/readings.hpp | 6 +++-- + src/utils/queue_list.hpp | 55 ++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 73 insertions(+), 30 deletions(-) + create mode 100644 src/utils/queue_list.hpp + +diff --git a/src/report.cpp b/src/report.cpp +index 06985a5..55bb931 100644 +--- a/src/report.cpp ++++ b/src/report.cpp +@@ -419,44 +419,30 @@ std::unique_ptr<sdbusplus::asio::dbus_interface> + return dbusIface; + } + +- Readings Report::getHourReadings() ++ Readings Report::getHourReadings() const + { +- static constexpr int ZERO_POSITION = 0; +- + Readings result; + std::get<0>(result) = std::get<0>(readings); +- auto& result_read = std::get<1>(result);; +- +- auto& read = std::get<1>(readings); +- auto hour_pos = GetPositionOnLastHour(read); +- +- if(hour_pos == ZERO_POSITION) +- { +- return readings; +- } +- std::copy(read.begin() + hour_pos, read.end(), std::back_inserter(result_read)); +- ++ CopyHourData(std::get<1>(readings), std::get<1>(result)); + return result; + } + +- int Report::GetPositionOnLastHour(const std::vector<ReadingData>& readings) ++ void Report::CopyHourData(const std::list<ReadingData>& readings, std::list<ReadingData>& result) const + { + static constexpr uint32_t SECONDS_IN_HOUR = 60*60; +- static constexpr int DEFAULT_RESULT = 0; + + uint64_t time_past_hour = std::chrono::duration_cast<std::chrono::seconds>( +- std::chrono::system_clock::now().time_since_epoch()).count() - SECONDS_IN_HOUR; +- +- +- for(auto it = readings.rbegin(); it !=readings.rend(); ++it) ++ std::chrono::system_clock::now().time_since_epoch()).count() - SECONDS_IN_HOUR; ++ for(auto reading_it = readings.rbegin(); reading_it !=readings.rend(); ++reading_it) + { +- auto reading_time = std::get<2>(*it); +- if(reading_time < time_past_hour) ++ ++ auto reading_time = std::get<2>(*reading_it); ++ if(reading_time <= time_past_hour) + { +- return abs(readings.rend() - it); ++ return; + } ++ result.push_front(*reading_it); + } +- return DEFAULT_RESULT; + } + + void Report::timerProcForPeriodicReport(boost::system::error_code ec, +diff --git a/src/report.hpp b/src/report.hpp +index b55b01b..bfe9e04 100644 +--- a/src/report.hpp ++++ b/src/report.hpp +@@ -14,7 +14,6 @@ + #include "types/report_types.hpp" + #include "types/report_updates.hpp" + #include "types/reporting_type.hpp" +-#include "utils/circular_vector.hpp" + #include "utils/dbus_path_utils.hpp" + #include "utils/ensure.hpp" + #include "utils/messanger.hpp" +@@ -27,6 +26,7 @@ + #include <memory> + #include <unordered_set> + ++#include "utils/queue_list.hpp" + class Report : public interfaces::Report, public interfaces::MetricListener + { + class OnChangeContext +@@ -112,8 +112,8 @@ class Report : public interfaces::Report, public interfaces::MetricListener + void updateReadings(); + void scheduleTimer(); + std::vector<ErrorMessage> verify() const; +- Readings getHourReadings(); +- int GetPositionOnLastHour(const std::vector<ReadingData>& readings); ++ Readings getHourReadings() const; ++ void CopyHourData(const std::list<ReadingData>& readings, std::list<ReadingData>& result) const; + + std::string id; + const sdbusplus::message::object_path path; +@@ -128,7 +128,7 @@ class Report : public interfaces::Report, public interfaces::MetricListener + std::optional<uint64_t> appendLimit; + ReportUpdates reportUpdates; + Readings readings = {}; +- CircularVector<ReadingData> readingsBuffer; ++ QueueList<ReadingData> readingsBuffer; + std::shared_ptr<sdbusplus::asio::object_server> objServer; + std::unique_ptr<sdbusplus::asio::dbus_interface> reportIface; + std::unique_ptr<sdbusplus::asio::dbus_interface> deleteIface; +diff --git a/src/types/readings.hpp b/src/types/readings.hpp +index 74566eb..5101cd0 100644 +--- a/src/types/readings.hpp ++++ b/src/types/readings.hpp +@@ -1,10 +1,12 @@ + #pragma once + ++#include <list> ++ + #include "utils/labeled_tuple.hpp" + #include "utils/tstring.hpp" + + using ReadingData = std::tuple<std::string, double, uint64_t>; +-using Readings = std::tuple<uint64_t, std::vector<ReadingData>>; ++using Readings = std::tuple<uint64_t, std::list<ReadingData>>; + + using LabeledReadingData = + utils::LabeledTuple<ReadingData, +@@ -12,7 +14,7 @@ using LabeledReadingData = + utils::tstring::MetricValue, utils::tstring::Timestamp>; + + using LabeledReadings = +- utils::LabeledTuple<std::tuple<uint64_t, std::vector<LabeledReadingData>>, ++ utils::LabeledTuple<std::tuple<uint64_t, std::list<LabeledReadingData>>, + utils::tstring::Timestamp, utils::tstring::Readings>; + + namespace utils +diff --git a/src/utils/queue_list.hpp b/src/utils/queue_list.hpp +new file mode 100644 +index 0000000..3ed08db +--- /dev/null ++++ b/src/utils/queue_list.hpp +@@ -0,0 +1,55 @@ ++#include <list> ++ ++template <class T> ++class QueueList ++{ ++ public: ++ QueueList(std::list<T>& externalData, size_t maxSizeIn) ++ : data(externalData), maxSize(maxSizeIn) ++ { ++ } ++ ++ template <class... Args> ++ void emplace(Args&&... args) ++ { ++ if(maxSize == 0) ++ { ++ return; ++ } ++ if(isFull()) ++ { ++ data.pop_front(); ++ } ++ data.emplace_back(std::forward<Args>(args)...); ++ } ++ ++ void clear() ++ { ++ data.clear(); ++ } ++ ++ bool isFull() const noexcept ++ { ++ return data.size() == maxSize; ++ } ++ ++ void clearAndResize(size_t newMaxSize) ++ { ++ clear(); ++ maxSize = newMaxSize; ++ } ++ ++ auto begin() const noexcept ++ { ++ return data.begin(); ++ } ++ ++ auto end() const noexcept ++ { ++ return data.end(); ++ } ++ ++ private: ++ std::list<T>& data; ++ size_t maxSize; ++}; diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0003-fix-bug-circular-buffer.patch b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0003-fix-bug-circular-buffer.patch deleted file mode 100644 index 73972a50e6..0000000000 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/0003-fix-bug-circular-buffer.patch +++ /dev/null @@ -1,191 +0,0 @@ -From 0e4a90e8371dd196650e3d90dc2d8b98ab063b95 Mon Sep 17 00:00:00 2001 -From: eportnov <eportnov@ibs.ru> -Date: Thu, 25 Aug 2022 17:24:37 +0300 -Subject: [PATCH] fix bug circular buffer - ---- - src/report.cpp | 31 +++++++--------------- - src/report.hpp | 7 ++--- - src/types/readings.hpp | 6 +++-- - src/utils/queue_list.hpp | 55 ++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 72 insertions(+), 27 deletions(-) - create mode 100644 src/utils/queue_list.hpp - -diff --git a/src/report.cpp b/src/report.cpp -index a53f287..5d35006 100644 ---- a/src/report.cpp -+++ b/src/report.cpp -@@ -387,44 +387,31 @@ std::unique_ptr<sdbusplus::asio::dbus_interface> - return dbusIface; - } - --Readings Report::getHourReadings() -+Readings Report::getHourReadings() const - { -- static constexpr int ZERO_POSITION = 0; -- - Readings result; - std::get<0>(result) = std::get<0>(readings); -- auto& result_read = std::get<1>(result);; -- -- auto& read = std::get<1>(readings); -- auto hour_pos = GetPositionOnLastHour(read); - -- if(hour_pos == ZERO_POSITION) -- { -- return readings; -- } -- std::copy(read.begin() + hour_pos, read.end(), std::back_inserter(result_read)); -+ CopyHourData(std::get<1>(readings), std::get<1>(result)); - - return result; - } - --int Report::GetPositionOnLastHour(const std::vector<ReadingData>& readings) -+void Report::CopyHourData(const std::list<ReadingData>& readings, std::list<ReadingData>& result) const - { - static constexpr uint32_t SECONDS_IN_HOUR = 60*60; -- static constexpr int DEFAULT_RESULT = 0; -- -+ - uint64_t time_past_hour = std::chrono::duration_cast<std::chrono::seconds>( - std::chrono::system_clock::now().time_since_epoch()).count() - SECONDS_IN_HOUR; -- -- -- for(auto it = readings.rbegin(); it !=readings.rend(); ++it) -+ for(auto reading_it = readings.rbegin(); reading_it !=readings.rend(); ++reading_it) - { -- auto reading_time = std::get<2>(*it); -- if(reading_time < time_past_hour) -+ auto reading_time = std::get<2>(*reading_it); -+ if(reading_time <= time_past_hour) - { -- return abs(readings.rend() - it); -+ return; - } -+ result.push_front(*reading_it); - } -- return DEFAULT_RESULT; - } - - void Report::timerProcForPeriodicReport(boost::system::error_code ec, -diff --git a/src/report.hpp b/src/report.hpp -index 5353ce5..4a9e2b3 100644 ---- a/src/report.hpp -+++ b/src/report.hpp -@@ -23,6 +23,7 @@ - #include <chrono> - #include <memory> - #include <unordered_set> -+#include "utils/queue_list.hpp" - - class Report : public interfaces::Report, public interfaces::MetricListener - { -@@ -105,8 +106,8 @@ class Report : public interfaces::Report, public interfaces::MetricListener - bool shouldStoreMetricValues() const; - void updateReadings(); - void updateReportingType(ReportingType); -- Readings getHourReadings(); -- int GetPositionOnLastHour(const std::vector<ReadingData>& readings); -+ Readings getHourReadings() const; -+ void CopyHourData(const std::list<ReadingData>& readings, std::list<ReadingData>& result) const; - - std::string id; - std::string name; -@@ -120,7 +121,7 @@ class Report : public interfaces::Report, public interfaces::MetricListener - std::optional<uint64_t> appendLimit; - ReportUpdates reportUpdates; - Readings readings = {}; -- CircularVector<ReadingData> readingsBuffer; -+ QueueList<ReadingData> readingsBuffer; - std::shared_ptr<sdbusplus::asio::object_server> objServer; - std::unique_ptr<sdbusplus::asio::dbus_interface> reportIface; - std::unique_ptr<sdbusplus::asio::dbus_interface> deleteIface; -diff --git a/src/types/readings.hpp b/src/types/readings.hpp -index ec419ec..05a39fc 100644 ---- a/src/types/readings.hpp -+++ b/src/types/readings.hpp -@@ -1,10 +1,12 @@ - #pragma once - -+#include <list> -+ - #include "utils/labeled_tuple.hpp" - #include "utils/tstring.hpp" - - using ReadingData = std::tuple<std::string, double, uint32_t>; --using Readings = std::tuple<uint32_t, std::vector<ReadingData>>; -+using Readings = std::tuple<uint32_t, std::list<ReadingData>>; - - using LabeledReadingData = - utils::LabeledTuple<ReadingData, -@@ -12,7 +14,7 @@ using LabeledReadingData = - utils::tstring::MetricValue, utils::tstring::Timestamp>; - - using LabeledReadings = -- utils::LabeledTuple<std::tuple<uint32_t, std::vector<LabeledReadingData>>, -+ utils::LabeledTuple<std::tuple<uint32_t, std::list<LabeledReadingData>>, - utils::tstring::Timestamp, utils::tstring::Readings>; - - namespace utils -diff --git a/src/utils/queue_list.hpp b/src/utils/queue_list.hpp -new file mode 100644 -index 0000000..1d25615 ---- /dev/null -+++ b/src/utils/queue_list.hpp -@@ -0,0 +1,55 @@ -+#include <list> -+ -+template <class T> -+class QueueList -+{ -+ public: -+ QueueList(std::list<T>& externalData, size_t maxSizeIn) -+ : data(externalData), maxSize(maxSizeIn) -+ { -+ } -+ -+ template <class... Args> -+ void emplace(Args&&... args) -+ { -+ if(maxSize == 0) -+ { -+ return; -+ } -+ if(isFull()) -+ { -+ data.pop_front(); -+ } -+ data.emplace_back(std::forward<Args>(args)...); -+ } -+ -+ void clear() -+ { -+ data.clear(); -+ } -+ -+ bool isFull() const noexcept -+ { -+ return data.size() == maxSize; -+ } -+ -+ void clearAndResize(size_t newMaxSize) -+ { -+ clear(); -+ maxSize = newMaxSize; -+ } -+ -+ auto begin() const noexcept -+ { -+ return data.begin(); -+ } -+ -+ auto end() const noexcept -+ { -+ return data.end(); -+ } -+ -+ private: -+ std::list<T>& data; -+ size_t maxSize; -+}; diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361602 b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361602 index 01c02bc6d8..4796f8a90a 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361602 +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361602 @@ -1 +1 @@ -{"AppendLimit":17280,"Enabled":true,"Id":"cpu_voltage","Interval":10,"Name":"cpu_voltage","ReadingParameters":[{"collectionDuration":2,"collectionTimeScope":0,"id":"cpu_voltage","operationType":2,"sensorPath":[{"metadata":"PVCCIN_CPU1","path":"/xyz/openbmc_project/sensors/voltage/PVCCIN_CPU1","service":"xyz.openbmc_project.ADCSensor"},{"metadata":"PVCCIN_CPU2","path":"/xyz/openbmc_project/sensors/voltage/PVCCIN_CPU2","service":"xyz.openbmc_project.ADCSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} +{"AppendLimit":17280,"Enabled":true,"Id":"cpu_voltage","Interval":10000,"Name":"cpu_voltage","ReadingParameters":[{"collectionDuration":2,"collectionTimeScope":0,"id":"cpu_voltage","operationType":2,"sensorPath":[{"metadata":"PVCCIN_CPU1","path":"/xyz/openbmc_project/sensors/voltage/PVCCIN_CPU1","service":"xyz.openbmc_project.ADCSensor"},{"metadata":"PVCCIN_CPU2","path":"/xyz/openbmc_project/sensors/voltage/PVCCIN_CPU2","service":"xyz.openbmc_project.ADCSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361603 b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361603 index d6d8078585..f76e9079f1 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361603 +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361603 @@ -1 +1 @@ -{"AppendLimit":86400,"Enabled":true,"Id":"fans","Interval":10,"Name":"fans","ReadingParameters":[{"collectionDuration":10,"collectionTimeScope":0,"id":"fans","operationType":2,"sensorPath":[{"metadata":"CPU1_Fan","path":"/xyz/openbmc_project/sensors/fan_tach/CPU1_Fan","service":"xyz.openbmc_project.FanSensor"},{"metadata":"CPU2_Fan","path":"/xyz/openbmc_project/sensors/fan_tach/CPU2_Fan","service":"xyz.openbmc_project.FanSensor"},{"metadata":"System_Fan_1","path":"/xyz/openbmc_project/sensors/fan_tach/System_Fan_1","service":"xyz.openbmc_project.FanSensor"},{"metadata":"System_Fan_2","path":"/xyz/openbmc_project/sensors/fan_tach/System_Fan_2","service":"xyz.openbmc_project.FanSensor"},{"metadata":"System_Fan_3","path":"/xyz/openbmc_project/sensors/fan_tach/System_Fan_3","service":"xyz.openbmc_project.FanSensor"},{"metadata":"Pwm_1","path":"/xyz/openbmc_project/sensors/fan_pwm/Pwm_1","service":"xyz.openbmc_project.FanSensor"},{"metadata":"Pwm_5","path":"/xyz/openbmc_project/sensors/fan_pwm/Pwm_5","service":"xyz.openbmc_project.FanSensor"},{"metadata":"Pwm_6","path":"/xyz/openbmc_project/sensors/fan_pwm/Pwm_6","service":"xyz.openbmc_project.FanSensor"},{"metadata":"Pwm_7","path":"/xyz/openbmc_project/sensors/fan_pwm/Pwm_7","service":"xyz.openbmc_project.FanSensor"},{"metadata":"Pwm_8","path":"/xyz/openbmc_project/sensors/fan_pwm/Pwm_8","service":"xyz.openbmc_project.FanSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} +{"AppendLimit":86400,"Enabled":true,"Id":"fans","Interval":10000,"Name":"fans","ReadingParameters":[{"collectionDuration":10,"collectionTimeScope":0,"id":"fans","operationType":2,"sensorPath":[{"metadata":"CPU1_Fan","path":"/xyz/openbmc_project/sensors/fan_tach/CPU1_Fan","service":"xyz.openbmc_project.FanSensor"},{"metadata":"CPU2_Fan","path":"/xyz/openbmc_project/sensors/fan_tach/CPU2_Fan","service":"xyz.openbmc_project.FanSensor"},{"metadata":"System_Fan_1","path":"/xyz/openbmc_project/sensors/fan_tach/System_Fan_1","service":"xyz.openbmc_project.FanSensor"},{"metadata":"System_Fan_2","path":"/xyz/openbmc_project/sensors/fan_tach/System_Fan_2","service":"xyz.openbmc_project.FanSensor"},{"metadata":"System_Fan_3","path":"/xyz/openbmc_project/sensors/fan_tach/System_Fan_3","service":"xyz.openbmc_project.FanSensor"},{"metadata":"Pwm_1","path":"/xyz/openbmc_project/sensors/fan_pwm/Pwm_1","service":"xyz.openbmc_project.FanSensor"},{"metadata":"Pwm_5","path":"/xyz/openbmc_project/sensors/fan_pwm/Pwm_5","service":"xyz.openbmc_project.FanSensor"},{"metadata":"Pwm_6","path":"/xyz/openbmc_project/sensors/fan_pwm/Pwm_6","service":"xyz.openbmc_project.FanSensor"},{"metadata":"Pwm_7","path":"/xyz/openbmc_project/sensors/fan_pwm/Pwm_7","service":"xyz.openbmc_project.FanSensor"},{"metadata":"Pwm_8","path":"/xyz/openbmc_project/sensors/fan_pwm/Pwm_8","service":"xyz.openbmc_project.FanSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361604 b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361604 index 571b836771..a5a3feec3c 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361604 +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361604 @@ -1 +1 @@ -{"AppendLimit":17280,"Enabled":true,"Id":"cpu_temp","Interval":10,"Name":"cpu_temp","ReadingParameters":[{"collectionDuration":2,"collectionTimeScope":0,"id":"cpu_temp","operationType":2,"sensorPath":[{"metadata":"Die_CPU1","path":"/xyz/openbmc_project/sensors/temperature/Die_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"Die_CPU2","path":"/xyz/openbmc_project/sensors/temperature/Die_CPU2","service":"xyz.openbmc_project.CPUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} +{"AppendLimit":17280,"Enabled":true,"Id":"cpu_temp","Interval":10000,"Name":"cpu_temp","ReadingParameters":[{"collectionDuration":2,"collectionTimeScope":0,"id":"cpu_temp","operationType":2,"sensorPath":[{"metadata":"Die_CPU1","path":"/xyz/openbmc_project/sensors/temperature/Die_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"Die_CPU2","path":"/xyz/openbmc_project/sensors/temperature/Die_CPU2","service":"xyz.openbmc_project.CPUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361605 b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361605 index 05aa4b2a41..d9226bd9d3 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361605 +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361605 @@ -1 +1 @@ -{"AppendLimit":69120,"Enabled":true,"Id":"dimm_temp","Interval":10,"Name":"dimm_temp","ReadingParameters":[{"collectionDuration":8,"collectionTimeScope":0,"id":"dimm_temp","operationType":2,"sensorPath":[{"metadata":"DIMM_A1_CPU1","path":"/xyz/openbmc_project/sensors/temperature/DIMM_A1_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_A1_CPU2","path":"/xyz/openbmc_project/sensors/temperature/DIMM_A1_CPU2","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_B1_CPU1","path":"/xyz/openbmc_project/sensors/temperature/DIMM_B1_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_B1_CPU2","path":"/xyz/openbmc_project/sensors/temperature/DIMM_B1_CPU2","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_D1_CPU1","path":"/xyz/openbmc_project/sensors/temperature/DIMM_D1_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_D1_CPU2","path":"/xyz/openbmc_project/sensors/temperature/DIMM_D1_CPU2","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_E1_CPU1","path":"/xyz/openbmc_project/sensors/temperature/DIMM_E1_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_E1_CPU2","path":"/xyz/openbmc_project/sensors/temperature/DIMM_E1_CPU2","service":"xyz.openbmc_project.CPUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} +{"AppendLimit":69120,"Enabled":true,"Id":"dimm_temp","Interval":10000,"Name":"dimm_temp","ReadingParameters":[{"collectionDuration":8,"collectionTimeScope":0,"id":"dimm_temp","operationType":2,"sensorPath":[{"metadata":"DIMM_A1_CPU1","path":"/xyz/openbmc_project/sensors/temperature/DIMM_A1_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_A1_CPU2","path":"/xyz/openbmc_project/sensors/temperature/DIMM_A1_CPU2","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_B1_CPU1","path":"/xyz/openbmc_project/sensors/temperature/DIMM_B1_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_B1_CPU2","path":"/xyz/openbmc_project/sensors/temperature/DIMM_B1_CPU2","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_D1_CPU1","path":"/xyz/openbmc_project/sensors/temperature/DIMM_D1_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_D1_CPU2","path":"/xyz/openbmc_project/sensors/temperature/DIMM_D1_CPU2","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_E1_CPU1","path":"/xyz/openbmc_project/sensors/temperature/DIMM_E1_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DIMM_E1_CPU2","path":"/xyz/openbmc_project/sensors/temperature/DIMM_E1_CPU2","service":"xyz.openbmc_project.CPUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361606 b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361606 index f9f480992c..356226a0bf 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361606 +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361606 @@ -1 +1 @@ -{"AppendLimit":51840,"Enabled":true,"Id":"other_temp","Interval":10,"Name":"other_temp","ReadingParameters":[{"collectionDuration":6,"collectionTimeScope":0,"id":"other_temp","operationType":2,"sensorPath":[{"metadata":"DTS_CPU1","path":"/xyz/openbmc_project/sensors/temperature/DTS_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DTS_CPU2","path":"/xyz/openbmc_project/sensors/temperature/DTS_CPU2","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"Inlet_BRD_Temp","path":"/xyz/openbmc_project/sensors/temperature/Inlet_BRD_Temp","service":"xyz.openbmc_project.HwmonTempSensor"},{"metadata":"PCH___M_2_Temp","path":"/xyz/openbmc_project/sensors/temperature/PCH___M_2_Temp","service":"xyz.openbmc_project.HwmonTempSensor"},{"metadata":"Right_side_of_the_board_Temp","path":"/xyz/openbmc_project/sensors/temperature/Right_side_of_the_board_Temp","service":"xyz.openbmc_project.HwmonTempSensor"},{"metadata":"BMC_Temp","path":"/xyz/openbmc_project/sensors/temperature/BMC_Temp","service":"xyz.openbmc_project.HwmonTempSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} +{"AppendLimit":51840,"Enabled":true,"Id":"other_temp","Interval":10000,"Name":"other_temp","ReadingParameters":[{"collectionDuration":6,"collectionTimeScope":0,"id":"other_temp","operationType":2,"sensorPath":[{"metadata":"DTS_CPU1","path":"/xyz/openbmc_project/sensors/temperature/DTS_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"DTS_CPU2","path":"/xyz/openbmc_project/sensors/temperature/DTS_CPU2","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"Inlet_BRD_Temp","path":"/xyz/openbmc_project/sensors/temperature/Inlet_BRD_Temp","service":"xyz.openbmc_project.HwmonTempSensor"},{"metadata":"PCH___M_2_Temp","path":"/xyz/openbmc_project/sensors/temperature/PCH___M_2_Temp","service":"xyz.openbmc_project.HwmonTempSensor"},{"metadata":"Right_side_of_the_board_Temp","path":"/xyz/openbmc_project/sensors/temperature/Right_side_of_the_board_Temp","service":"xyz.openbmc_project.HwmonTempSensor"},{"metadata":"BMC_Temp","path":"/xyz/openbmc_project/sensors/temperature/BMC_Temp","service":"xyz.openbmc_project.HwmonTempSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361607 b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361607 index ccd23f9a53..b3410cb10a 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361607 +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361607 @@ -1 +1 @@ -{"AppendLimit":17280,"Enabled":true,"Id":"power","Interval":10,"Name":"power","ReadingParameters":[{"collectionDuration":2,"collectionTimeScope":0,"id":"power","operationType":2,"sensorPath":[{"metadata":"Cpu_Power_Average_CPU1","path":"/xyz/openbmc_project/sensors/power/Cpu_Power_Average_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"Cpu_Power_Average_CPU2","path":"/xyz/openbmc_project/sensors/power/Cpu_Power_Average_CPU2","service":"xyz.openbmc_project.CPUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} +{"AppendLimit":17280,"Enabled":true,"Id":"power","Interval":10000,"Name":"power","ReadingParameters":[{"collectionDuration":2,"collectionTimeScope":0,"id":"power","operationType":2,"sensorPath":[{"metadata":"Cpu_Power_Average_CPU1","path":"/xyz/openbmc_project/sensors/power/Cpu_Power_Average_CPU1","service":"xyz.openbmc_project.CPUSensor"},{"metadata":"Cpu_Power_Average_CPU2","path":"/xyz/openbmc_project/sensors/power/Cpu_Power_Average_CPU2","service":"xyz.openbmc_project.CPUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361608 b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361608 index 3f5aa281bb..fa3586eb7a 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361608 +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361608 @@ -1 +1 @@ -{"AppendLimit":34560,"Enabled":true,"Id":"psu_current","Interval":10,"Name":"report_name","ReadingParameters":[{"collectionDuration":4,"collectionTimeScope":0,"id":"psu_current","operationType":2,"sensorPath":[{"metadata":"PSU1_Input_Current","path":"/xyz/openbmc_project/sensors/current/PSU1_Input_Current","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Input_Current","path":"/xyz/openbmc_project/sensors/current/PSU2_Input_Current","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU1_Output_Current","path":"/xyz/openbmc_project/sensors/current/PSU1_Output_Current","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Output_Current","path":"/xyz/openbmc_project/sensors/current/PSU2_Output_Current","service":"xyz.openbmc_project.PSUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} +{"AppendLimit":34560,"Enabled":true,"Id":"psu_current","Interval":10000,"Name":"report_name","ReadingParameters":[{"collectionDuration":4,"collectionTimeScope":0,"id":"psu_current","operationType":2,"sensorPath":[{"metadata":"PSU1_Input_Current","path":"/xyz/openbmc_project/sensors/current/PSU1_Input_Current","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Input_Current","path":"/xyz/openbmc_project/sensors/current/PSU2_Input_Current","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU1_Output_Current","path":"/xyz/openbmc_project/sensors/current/PSU1_Output_Current","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Output_Current","path":"/xyz/openbmc_project/sensors/current/PSU2_Output_Current","service":"xyz.openbmc_project.PSUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361609 b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361609 index 2560e2e5d4..79a7e0de53 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361609 +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361609 @@ -1 +1 @@ -{"AppendLimit":34560,"Enabled":true,"Id":"psu_power","Interval":10,"Name":"report_name","ReadingParameters":[{"collectionDuration":4,"collectionTimeScope":0,"id":"psu_power","operationType":2,"sensorPath":[{"metadata":"PSU1_Input_Power","path":"/xyz/openbmc_project/sensors/power/PSU1_Input_Power","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Input_Power","path":"/xyz/openbmc_project/sensors/power/PSU2_Input_Power","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU1_Output_Power","path":"/xyz/openbmc_project/sensors/power/PSU1_Output_Power","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Output_Power","path":"/xyz/openbmc_project/sensors/power/PSU2_Output_Power","service":"xyz.openbmc_project.PSUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} +{"AppendLimit":34560,"Enabled":true,"Id":"psu_power","Interval":10000,"Name":"report_name","ReadingParameters":[{"collectionDuration":4,"collectionTimeScope":0,"id":"psu_power","operationType":2,"sensorPath":[{"metadata":"PSU1_Input_Power","path":"/xyz/openbmc_project/sensors/power/PSU1_Input_Power","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Input_Power","path":"/xyz/openbmc_project/sensors/power/PSU2_Input_Power","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU1_Output_Power","path":"/xyz/openbmc_project/sensors/power/PSU1_Output_Power","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Output_Power","path":"/xyz/openbmc_project/sensors/power/PSU2_Output_Power","service":"xyz.openbmc_project.PSUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361610 b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361610 index 9908c37467..ebac751341 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361610 +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361610 @@ -1 +1 @@ -{"AppendLimit":17280,"Enabled":true,"Id":"psu_temp","Interval":10,"Name":"report_name","ReadingParameters":[{"collectionDuration":2,"collectionTimeScope":0,"id":"psu_temp","operationType":2,"sensorPath":[{"metadata":"PSU1_Temperature","path":"/xyz/openbmc_project/sensors/temperature/PSU1_Temperature","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Temperature","path":"/xyz/openbmc_project/sensors/temperature/PSU2_Temperature","service":"xyz.openbmc_project.PSUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} +{"AppendLimit":17280,"Enabled":true,"Id":"psu_temp","Interval":10000,"Name":"report_name","ReadingParameters":[{"collectionDuration":2,"collectionTimeScope":0,"id":"psu_temp","operationType":2,"sensorPath":[{"metadata":"PSU1_Temperature","path":"/xyz/openbmc_project/sensors/temperature/PSU1_Temperature","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Temperature","path":"/xyz/openbmc_project/sensors/temperature/PSU2_Temperature","service":"xyz.openbmc_project.PSUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361611 b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361611 index 1c70b8d0aa..7391e2e75b 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361611 +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry/3017361611 @@ -1 +1 @@ -{"AppendLimit":34560,"Enabled":true,"Id":"psu_voltage","Interval":10,"Name":"report_name","ReadingParameters":[{"collectionDuration":4,"collectionTimeScope":0,"id":"psu_voltage","operationType":2,"sensorPath":[{"metadata":"PSU1_Input_Voltage","path":"/xyz/openbmc_project/sensors/voltage/PSU1_Input_Voltage","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Input_Voltage","path":"/xyz/openbmc_project/sensors/voltage/PSU2_Input_Voltage","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU1_Output_Voltage","path":"/xyz/openbmc_project/sensors/voltage/PSU1_Output_Voltage","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Output_Voltage","path":"/xyz/openbmc_project/sensors/voltage/PSU2_Output_Voltage","service":"xyz.openbmc_project.PSUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} +{"AppendLimit":34560,"Enabled":true,"Id":"psu_voltage","Interval":10000,"Name":"report_name","ReadingParameters":[{"collectionDuration":4,"collectionTimeScope":0,"id":"psu_voltage","operationType":2,"sensorPath":[{"metadata":"PSU1_Input_Voltage","path":"/xyz/openbmc_project/sensors/voltage/PSU1_Input_Voltage","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Input_Voltage","path":"/xyz/openbmc_project/sensors/voltage/PSU2_Input_Voltage","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU1_Output_Voltage","path":"/xyz/openbmc_project/sensors/voltage/PSU1_Output_Voltage","service":"xyz.openbmc_project.PSUSensor"},{"metadata":"PSU2_Output_Voltage","path":"/xyz/openbmc_project/sensors/voltage/PSU2_Output_Voltage","service":"xyz.openbmc_project.PSUSensor"}]}],"ReportActions":[1],"ReportUpdates":2,"ReportingType":0,"Version":6} diff --git a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry_%.bbappend b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry_%.bbappend index 5119a9566b..5a6c13be05 100644 --- a/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry_%.bbappend +++ b/meta-ibs/meta-cp2-5422/recipes-phosphor/telemetry/telemetry_%.bbappend @@ -29,3 +29,32 @@ FILESEXTRAPATHS:append := "${THISDIR}/${PN}:" # cp ${WORKDIR}/3017361610 ${D}/var/lib/telemetry/Reports # cp ${WORKDIR}/3017361611 ${D}/var/lib/telemetry/Reports #} +SRC_URI += "file://3017361602 \ + file://3017361603 \ + file://3017361604 \ + file://3017361605 \ + file://3017361606 \ + file://3017361607 \ + file://3017361608 \ + file://3017361609 \ + file://3017361610 \ + file://3017361611 \ + file://0001-configure-telemetry.patch \ + file://0002-add-hour-data.patch \ + file://0003-bugfix-circular-buffer.patch \ + " + +do_install:append() { + install -d ${D}/var/lib/telemetry/Reports + + install -m 0744 ${WORKDIR}/3017361602 ${D}/var/lib/telemetry/Reports + install -m 0744 ${WORKDIR}/3017361603 ${D}/var/lib/telemetry/Reports + install -m 0744 ${WORKDIR}/3017361604 ${D}/var/lib/telemetry/Reports + install -m 0744 ${WORKDIR}/3017361605 ${D}/var/lib/telemetry/Reports + install -m 0744 ${WORKDIR}/3017361606 ${D}/var/lib/telemetry/Reports + install -m 0744 ${WORKDIR}/3017361607 ${D}/var/lib/telemetry/Reports + install -m 0744 ${WORKDIR}/3017361608 ${D}/var/lib/telemetry/Reports + install -m 0744 ${WORKDIR}/3017361609 ${D}/var/lib/telemetry/Reports + install -m 0744 ${WORKDIR}/3017361610 ${D}/var/lib/telemetry/Reports + install -m 0744 ${WORKDIR}/3017361611 ${D}/var/lib/telemetry/Reports +} |