Skip to content

Commit

Permalink
pybind/mgr/prometheus: don't crash when encountering an unknown PG state
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
  • Loading branch information
Jan Fajerski committed Nov 13, 2017
1 parent 1ecc188 commit 67a1b66
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pybind/mgr/prometheus/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ def get_pg_status(self):
key.split('+')]
for state, value in reported_pg_s:
path = 'pg_{}'.format(state)
self.metrics[path].set(value)
try:
self.metrics[path].set(value)
except KeyError:
self.log.warn('Skipping unknown PG State {}'.format(state))
reported_states = [s[0] for s in reported_pg_s]
for state in PG_STATES:
path = 'pg_{}'.format(state)
Expand Down

0 comments on commit 67a1b66

Please sign in to comment.