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: |
Szymon Dompke | 32305f1 | 2022-07-05 15:37:21 +0200 | [diff] [blame] | 12 | ReportParams& reportId(std::string_view val) |
Krzysztof Grobelny | b8cc78d | 2021-11-29 15:54:53 +0100 | [diff] [blame] | 13 | { |
Szymon Dompke | 32305f1 | 2022-07-05 15:37:21 +0200 | [diff] [blame] | 14 | reportIdProperty = val; |
Krzysztof Grobelny | b8cc78d | 2021-11-29 15:54:53 +0100 | [diff] [blame] | 15 | return *this; |
| 16 | } |
| 17 | |
| 18 | const std::string& reportId() const |
| 19 | { |
| 20 | return reportIdProperty; |
| 21 | } |
| 22 | |
Szymon Dompke | 32305f1 | 2022-07-05 15:37:21 +0200 | [diff] [blame] | 23 | ReportParams& reportName(std::string_view val) |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 24 | { |
Szymon Dompke | 32305f1 | 2022-07-05 15:37:21 +0200 | [diff] [blame] | 25 | reportNameProperty = val; |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 26 | return *this; |
| 27 | } |
| 28 | |
| 29 | const std::string& reportName() const |
| 30 | { |
| 31 | return reportNameProperty; |
| 32 | } |
| 33 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame] | 34 | ReportParams& reportingType(const ReportingType val) |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 35 | { |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame] | 36 | reportingTypeProperty = val; |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 37 | return *this; |
| 38 | } |
| 39 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame] | 40 | ReportingType reportingType() const |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 41 | { |
| 42 | return reportingTypeProperty; |
| 43 | } |
| 44 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame] | 45 | ReportParams& reportActions(std::vector<ReportAction> val) |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 46 | { |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame] | 47 | reportActionsProperty = std::move(val); |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 48 | return *this; |
| 49 | } |
| 50 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame] | 51 | std::vector<ReportAction> reportActions() const |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 52 | { |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame] | 53 | return reportActionsProperty; |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 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 | |
Szymon Dompke | 3eb5686 | 2021-09-20 15:32:04 +0200 | [diff] [blame] | 78 | ReportParams& appendLimit(uint64_t val) |
| 79 | { |
| 80 | appendLimitProperty = val; |
| 81 | return *this; |
| 82 | } |
| 83 | |
| 84 | uint64_t appendLimit() const |
| 85 | { |
| 86 | return appendLimitProperty; |
| 87 | } |
| 88 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame] | 89 | ReportParams& reportUpdates(ReportUpdates val) |
Szymon Dompke | 3eb5686 | 2021-09-20 15:32:04 +0200 | [diff] [blame] | 90 | { |
| 91 | reportUpdatesProperty = val; |
| 92 | return *this; |
| 93 | } |
| 94 | |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame] | 95 | ReportUpdates reportUpdates() const |
Szymon Dompke | 3eb5686 | 2021-09-20 15:32:04 +0200 | [diff] [blame] | 96 | { |
| 97 | return reportUpdatesProperty; |
| 98 | } |
| 99 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 100 | ReportParams& metricParameters(std::vector<LabeledMetricParameters> val) |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 101 | { |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 102 | metricParametersProperty = std::move(val); |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 103 | return *this; |
| 104 | } |
| 105 | |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 106 | const std::vector<LabeledMetricParameters>& metricParameters() const |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 107 | { |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 108 | return metricParametersProperty; |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 109 | } |
| 110 | |
Krzysztof Grobelny | 493e62e | 2022-02-14 10:55:50 +0100 | [diff] [blame] | 111 | ReportParams& readings(Readings val) |
| 112 | { |
| 113 | readingsProperty = std::move(val); |
| 114 | return *this; |
| 115 | } |
| 116 | |
| 117 | Readings readings() const |
| 118 | { |
| 119 | return readingsProperty; |
| 120 | } |
| 121 | |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 122 | private: |
Krzysztof Grobelny | b8cc78d | 2021-11-29 15:54:53 +0100 | [diff] [blame] | 123 | std::string reportIdProperty = "TestId"; |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 124 | std::string reportNameProperty = "TestReport"; |
Krzysztof Grobelny | 973b4bb | 2022-04-25 17:07:27 +0200 | [diff] [blame] | 125 | ReportingType reportingTypeProperty = ReportingType::onChange; |
Szymon Dompke | fdb06a1 | 2022-02-11 11:04:44 +0100 | [diff] [blame] | 126 | std::vector<ReportAction> reportActionsProperty = { |
| 127 | ReportAction::logToMetricReportsCollection}; |
Krzysztof Grobelny | 973b4bb | 2022-04-25 17:07:27 +0200 | [diff] [blame] | 128 | Milliseconds intervalProperty{}; |
Szymon Dompke | 3eb5686 | 2021-09-20 15:32:04 +0200 | [diff] [blame] | 129 | uint64_t appendLimitProperty = 123; |
Krzysztof Grobelny | 51497a0 | 2021-11-09 14:56:22 +0100 | [diff] [blame] | 130 | ReportUpdates reportUpdatesProperty = ReportUpdates::overwrite; |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 131 | std::vector<LabeledMetricParameters> metricParametersProperty{ |
| 132 | {LabeledMetricParameters{ |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 133 | {LabeledSensorInfo{"Service", |
| 134 | "/xyz/openbmc_project/sensors/power/p1", |
| 135 | "metadata1"}}, |
Krzysztof Grobelny | 60fee07 | 2022-01-13 16:25:04 +0100 | [diff] [blame] | 136 | OperationType::avg, |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 137 | CollectionTimeScope::point, |
| 138 | CollectionDuration(Milliseconds(0u))}, |
| 139 | LabeledMetricParameters{ |
Szymon Dompke | 94f71c5 | 2021-12-10 07:16:33 +0100 | [diff] [blame] | 140 | {LabeledSensorInfo{"Service", |
| 141 | "/xyz/openbmc_project/sensors/power/p2", |
| 142 | "metadata2"}}, |
Krzysztof Grobelny | 60fee07 | 2022-01-13 16:25:04 +0100 | [diff] [blame] | 143 | OperationType::avg, |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 144 | CollectionTimeScope::point, |
| 145 | CollectionDuration(Milliseconds(0u))}}}; |
Lukasz Kazmierczak | 7e098e9 | 2021-09-16 15:59:56 +0200 | [diff] [blame] | 146 | bool enabledProperty = true; |
Krzysztof Grobelny | 493e62e | 2022-02-14 10:55:50 +0100 | [diff] [blame] | 147 | Readings readingsProperty = {}; |
Krzysztof Grobelny | d223819 | 2020-12-02 09:27:28 +0000 | [diff] [blame] | 148 | }; |