xref: /openbmc/telemetry/tests/src/params/report_params.hpp (revision dcc4e1936173a93251a02066432bc2bcbc386240)
1 #pragma once
2 
3 #include "report_manager.hpp"
4 #include "types/report_types.hpp"
5 
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 
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 
56     ReportParams& interval(Milliseconds val)
57     {
58         intervalProperty = val;
59         return *this;
60     }
61 
62     Milliseconds interval() const
63     {
64         return intervalProperty;
65     }
66 
67     ReportParams& metricParameters(std::vector<LabeledMetricParameters> val)
68     {
69         metricParametersProperty = std::move(val);
70         return *this;
71     }
72 
73     const std::vector<LabeledMetricParameters>& metricParameters() const
74     {
75         return metricParametersProperty;
76     }
77 
78   private:
79     std::string reportNameProperty = "TestReport";
80     std::string reportingTypeProperty = "OnRequest";
81     bool emitReadingUpdateProperty = true;
82     bool logToMetricReportCollectionProperty = true;
83     Milliseconds intervalProperty = ReportManager::minInterval;
84     std::vector<LabeledMetricParameters> metricParametersProperty{
85         {LabeledMetricParameters{
86              {LabeledSensorParameters{"Service",
87                                       "/xyz/openbmc_project/sensors/power/p1"}},
88              OperationType::single,
89              "MetricId1",
90              "Metadata1",
91              CollectionTimeScope::point,
92              CollectionDuration(Milliseconds(0u))},
93          LabeledMetricParameters{
94              {LabeledSensorParameters{"Service",
95                                       "/xyz/openbmc_project/sensors/power/p2"}},
96              OperationType::single,
97              "MetricId2",
98              "Metadata2",
99              CollectionTimeScope::point,
100              CollectionDuration(Milliseconds(0u))}}};
101 };
102