From 456b12b96cd6e0c8681d49416874fd2ad02c8269 Mon Sep 17 00:00:00 2001 From: Pere Diaz Bou Date: Mon, 8 Aug 2022 12:51:16 +0200 Subject: [PATCH] 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 --- src/pybind/mgr/prometheus/module.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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(): -- 2.47.3