From c288624eed862559b2c86c5dfc85c837716739ab Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Thu, 10 Aug 2017 18:15:56 +0200 Subject: [PATCH] pybind/mgr/prometheus: actually emit reported pg counts Signed-off-by: Jan Fajerski --- src/pybind/mgr/prometheus/module.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index aeb464b1a48..c246449f9fd 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()