From: Pere Diaz Bou Date: Mon, 8 Aug 2022 10:51:16 +0000 (+0200) Subject: mgr/prometheus: expose num objects repaired in pool X-Git-Tag: v16.2.11~270^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F48205%2Fhead;p=ceph.git mgr/prometheus: expose num objects repaired in pool Signed-off-by: Pere Diaz Bou (cherry picked from commit a84620552a527ad30376de115e76a3d4555ca5e9) Conflicts: src/pybind/mgr/prometheus/module.py in get_df we had to not accept incoming changes --- diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 6516dc352516..0d073eb6b033 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -1550,6 +1550,20 @@ class Module(MgrModule): cast(MetricCounter, sum_metric).add(duration, (method_name,)) cast(MetricCounter, count_metric).add(1, (method_name,)) + def get_pg_repaired_objects(self) -> None: + dump = self.get('pg_dump') + for stats in dump['pool_stats']: + path = f'pg_objects_repaired{stats["poolid"]}' + self.metrics[path] = Metric( + 'counter', + 'pg_objects_repaired', + 'Number of objects repaired in a pool Count', + ('poolid',) + ) + + self.metrics[path].set(stats['stat_sum']['num_objects_repaired'], + labelvalues=(stats['poolid'],)) + @profile_method(True) def collect(self) -> str: # Clear the metrics before scraping @@ -1565,6 +1579,7 @@ class Module(MgrModule): self.get_mgr_status() self.get_metadata_and_osd_status() self.get_pg_status() + self.get_pg_repaired_objects() self.get_num_objects() for daemon, counters in self.get_all_perf_counters().items():