]> git.proxmox.com Git - ceph.git/blob - ceph/src/mgr/OSDHealthMetricCollector.h
update sources to v12.2.3
[ceph.git] / ceph / src / mgr / OSDHealthMetricCollector.h
1 #include <memory>
2 #include <string>
3
4 #include "osd/OSDHealthMetric.h"
5 #include "mon/health_check.h"
6
7 class OSDHealthMetricCollector {
8 public:
9 using DaemonKey = std::pair<std::string, std::string>;
10 static std::unique_ptr<OSDHealthMetricCollector> create(osd_metric m);
11 void update(const DaemonKey& osd, const OSDHealthMetric& metric) {
12 if (_is_relevant(metric.get_type())) {
13 reported = _update(osd, metric);
14 }
15 }
16 void summarize(health_check_map_t& cm) {
17 if (reported) {
18 _summarize(_get_check(cm));
19 }
20 }
21 virtual ~OSDHealthMetricCollector() {}
22 private:
23 virtual bool _is_relevant(osd_metric type) const = 0;
24 virtual health_check_t& _get_check(health_check_map_t& cm) const = 0;
25 virtual bool _update(const DaemonKey& osd, const OSDHealthMetric& metric) = 0;
26 virtual void _summarize(health_check_t& check) const = 0;
27 protected:
28 osd_metric_t value;
29 bool reported = false;
30 };