From: Jan Fajerski Date: Thu, 10 Aug 2017 16:15:56 +0000 (+0200) Subject: pybind/mgr/prometheus: actually emit reported pg counts X-Git-Tag: v12.2.2~61^2~79 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e3dafc3dd682a10e2310efdac4615d834933e7d6;p=ceph.git pybind/mgr/prometheus: actually emit reported pg counts Signed-off-by: Jan Fajerski (cherry picked from commit c288624eed862559b2c86c5dfc85c837716739ab) --- diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 27184497a39f..35af2db1df33 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -310,10 +310,15 @@ class Module(MgrModule): for osd in pg_s: reported_pg_s = [(s,v) for key, v in pg_s[osd].items() for s in key.split('+')] + for state, value in reported_pg_s: + path = 'pg_{}'.format(state) + self.metrics[path].set(value, (osd,)) + reported_states = [s[0] for s in reported_pg_s] for state in PG_STATES: path = 'pg_{}'.format(state) - if state not in reported_pg_s: - self.metrics[path].set(0, ('osd.{}'.format(osd),)) + self.log.debug('rep_pgs: {}'.format(reported_pg_s)) + if state not in reported_states: + self.metrics[path].set(0, (osd,)) def collect(self): self.get_health()