From: Tobias Urdin Date: Mon, 20 Jun 2022 15:14:33 +0000 (+0000) Subject: mgr: influx: catch KeyError when looking up pool name X-Git-Tag: v18.0.0~621^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F46756%2Fhead;p=ceph.git mgr: influx: catch KeyError when looking up pool name It can lookup the pool name when a new pool is created and the pool_info doesn't contain it causing a KeyError. Signed-off-by: Tobias Urdin --- diff --git a/src/pybind/mgr/influx/module.py b/src/pybind/mgr/influx/module.py index 334b6c77f9f..f88261b20b1 100644 --- a/src/pybind/mgr/influx/module.py +++ b/src/pybind/mgr/influx/module.py @@ -233,11 +233,16 @@ class Module(MgrModule): def get_pg_summary_pool(self, pool_info: Dict[str, str], now: str) -> Iterator[Dict[str, Any]]: pool_sum = self.get('pg_summary')['by_pool'] for pool_id, stats in pool_sum.items(): + try: + pool_name = pool_info[pool_id] + except KeyError: + self.log.error('Unable to find pool name for pool {}'.format(pool_id)) + continue for stat in stats: yield { "measurement": "ceph_pg_summary_pool", "tags": { - "pool_name" : pool_info[pool_id], + "pool_name" : pool_name, "pool_id" : pool_id, "type_instance" : stat, },