]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: influx: catch KeyError when looking up pool name 46756/head
authorTobias Urdin <tobias.urdin@binero.se>
Mon, 20 Jun 2022 15:14:33 +0000 (15:14 +0000)
committerTobias Urdin <tobias.urdin@binero.se>
Thu, 23 Jun 2022 15:03:49 +0000 (15:03 +0000)
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 <tobias.urdin@binero.com>
src/pybind/mgr/influx/module.py

index 334b6c77f9f48eb49b0251c2ac3c6c4434d54690..f88261b20b14badd070562b6ee91700fee223eb1 100644 (file)
@@ -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,
                     },