From: Aleksei Zakharov Date: Fri, 20 Dec 2019 15:05:05 +0000 (+0300) Subject: mgr/prometheus: pg count by pool X-Git-Tag: v15.1.1~618^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=41e7d20d2cba19281e237a17a27f4544addd95a8;p=ceph-ci.git mgr/prometheus: pg count by pool If we have all other stats by pool, it's better to have total count by pool too. We always can sum() all of total, but it's hard to count by-pool total. Signed-off-by: Aleksei Zakharov --- diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index d58c1f67a18..d311c3cb431 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -318,7 +318,8 @@ class Module(MgrModule): metrics['pg_total'] = Metric( 'gauge', 'pg_total', - 'PG Total Count' + 'PG Total Count', + ('pool_id',) ) for flag in OSD_FLAGS: @@ -511,13 +512,11 @@ class Module(MgrModule): self.metrics['mgr_module_can_run'].set(_can_run, (mod_name,)) def get_pg_status(self): - # Set total count of PGs, first - pg_status = self.get('pg_status') - self.metrics['pg_total'].set(pg_status['num_pgs']) pg_summary = self.get('pg_summary') for pool in pg_summary['by_pool']: + total = 0 for state_name, count in pg_summary['by_pool'][pool].items(): reported_states = {} @@ -539,6 +538,8 @@ class Module(MgrModule): except KeyError: self.log.warn( "skipping pg in unknown state {}".format(state)) + total = total + count + self.metrics['pg_total'].set(total,(pool,)) def get_osd_stats(self): osd_stats = self.get('osd_stats')