pybind/mgr/prometheus: actually emit reported pg counts

Signed-off-by: Jan Fajerski <jfajerski@suse.com>
This commit is contained in:
Jan Fajerski 2017-08-10 18:15:56 +02:00 committed by John Spray
parent ead0973d7d
commit c288624eed

View File

@ -310,10 +310,15 @@ class Module(MgrModule):
for osd in pg_s: for osd in pg_s:
reported_pg_s = [(s,v) for key, v in pg_s[osd].items() for s in reported_pg_s = [(s,v) for key, v in pg_s[osd].items() for s in
key.split('+')] 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: for state in PG_STATES:
path = 'pg_{}'.format(state) path = 'pg_{}'.format(state)
if state not in reported_pg_s: self.log.debug('rep_pgs: {}'.format(reported_pg_s))
self.metrics[path].set(0, ('osd.{}'.format(osd),)) if state not in reported_states:
self.metrics[path].set(0, (osd,))
def collect(self): def collect(self):
self.get_health() self.get_health()