xref: /openbmc/telemetry/src/interfaces/metric.hpp (revision 3a1c297a)
1 #pragma once
2 
3 #include "interfaces/metric_listener.hpp"
4 #include "metric_value.hpp"
5 #include "types/duration_types.hpp"
6 #include "types/report_types.hpp"
7 
8 #include <nlohmann/json.hpp>
9 
10 #include <vector>
11 
12 namespace interfaces
13 {
14 
15 class Metric
16 {
17   public:
18     virtual ~Metric() = default;
19 
20     virtual void initialize() = 0;
21     virtual void deinitialize() = 0;
22     virtual const std::vector<MetricValue>& getUpdatedReadings() = 0;
23     virtual LabeledMetricParameters dumpConfiguration() const = 0;
24     virtual uint64_t metricCount() const = 0;
25     virtual void registerForUpdates(interfaces::MetricListener& listener) = 0;
26     virtual void
27         unregisterFromUpdates(interfaces::MetricListener& listener) = 0;
28     virtual void updateReadings(Milliseconds) = 0;
29     virtual bool isTimerRequired() const = 0;
30 };
31 
32 } // namespace interfaces
33