Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 3 | #include "report_manager.hpp" |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 4 | #include "types/report_types.hpp" |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 5 | |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 6 | #include <chrono> |
| 7 | #include <string> |
| 8 | |
| 9 | class ReportParams final |
| 10 | { |
| 11 | public: |
| 12 | ReportParams& reportName(std::string val) |
| 13 | { |
| 14 | reportNameProperty = std::move(val); |
| 15 | return *this; |
| 16 | } |
| 17 | |
| 18 | const std::string& reportName() const |
| 19 | { |
| 20 | return reportNameProperty; |
| 21 | } |
| 22 | |
| 23 | ReportParams& reportingType(std::string val) |
| 24 | { |
| 25 | reportingTypeProperty = std::move(val); |
| 26 | return *this; |
| 27 | } |
| 28 | |
| 29 | const std::string& reportingType() const |
| 30 | { |
| 31 | return reportingTypeProperty; |
| 32 | } |
| 33 | |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 34 | ReportParams& emitReadingUpdate(bool val) |
| 35 | { |
| 36 | emitReadingUpdateProperty = val; |
| 37 | return *this; |
| 38 | } |
| 39 | |
| 40 | bool emitReadingUpdate() const |
| 41 | { |
| 42 | return emitReadingUpdateProperty; |
| 43 | } |
| 44 | |
| 45 | ReportParams& logToMetricReportCollection(bool val) |
| 46 | { |
| 47 | logToMetricReportCollectionProperty = val; |
| 48 | return *this; |
| 49 | } |
| 50 | |
| 51 | bool logToMetricReportCollection() const |
| 52 | { |
| 53 | return logToMetricReportCollectionProperty; |
| 54 | } |
| 55 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 56 | ReportParams& interval(Milliseconds val) |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 57 | { |
| 58 | intervalProperty = val; |
| 59 | return *this; |
| 60 | } |
| 61 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 62 | Milliseconds interval() const |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 63 | { |
| 64 | return intervalProperty; |
| 65 | } |
| 66 | |
Lukasz Kazmierczak | 7e098e9 | 2021-09-16 15:59:56 +0200 | [diff] [blame] | 67 | ReportParams& enabled(bool val) |
| 68 | { |
| 69 | enabledProperty = val; |
| 70 | return *this; |
| 71 | } |
| 72 | |
| 73 | bool enabled() const |
| 74 | { |
| 75 | return enabledProperty; |
| 76 | } |
| 77 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 78 | ReportParams& metricParameters(std::vector<LabeledMetricParameters> val) |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 79 | { |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 80 | metricParametersProperty = std::move(val); |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 81 | return *this; |
| 82 | } |
| 83 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 84 | const std::vector<LabeledMetricParameters>& metricParameters() const |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 85 | { |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 86 | return metricParametersProperty; |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | private: |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 90 | std::string reportNameProperty = "TestReport"; |
| 91 | std::string reportingTypeProperty = "OnRequest"; |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 92 | bool emitReadingUpdateProperty = true; |
| 93 | bool logToMetricReportCollectionProperty = true; |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 94 | Milliseconds intervalProperty = ReportManager::minInterval; |
| 95 | std::vector<LabeledMetricParameters> metricParametersProperty{ |
| 96 | {LabeledMetricParameters{ |
| 97 | {LabeledSensorParameters{"Service", |
| 98 | "/xyz/openbmc_project/sensors/power/p1"}}, |
| 99 | OperationType::single, |
| 100 | "MetricId1", |
| 101 | "Metadata1", |
| 102 | CollectionTimeScope::point, |
| 103 | CollectionDuration(Milliseconds(0u))}, |
| 104 | LabeledMetricParameters{ |
| 105 | {LabeledSensorParameters{"Service", |
| 106 | "/xyz/openbmc_project/sensors/power/p2"}}, |
| 107 | OperationType::single, |
| 108 | "MetricId2", |
| 109 | "Metadata2", |
| 110 | CollectionTimeScope::point, |
| 111 | CollectionDuration(Milliseconds(0u))}}}; |
Lukasz Kazmierczak | 7e098e9 | 2021-09-16 15:59:56 +0200 | [diff] [blame] | 112 | bool enabledProperty = true; |
Krzysztof Grobelny | d223819 | 2020-12-02 09:27:28 +0000 | [diff] [blame] | 113 | }; |