]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/telemetry: add application to stats_per_pool
authorLaura Flores <lflores@redhat.com>
Thu, 16 Dec 2021 06:56:26 +0000 (06:56 +0000)
committerLaura Flores <lflores@redhat.com>
Wed, 22 Dec 2021 19:15:44 +0000 (19:15 +0000)
Signed-off-by: Laura Flores <lflores@redhat.com>
src/pybind/mgr/telemetry/module.py

index 9695c7236c9a7d2ce6aca8745dc27b2b7139b356..68ca97c1af4fe85728a5cd80082ee8c040ad9f3f 100644 (file)
@@ -499,6 +499,27 @@ class Module(MgrModule):
     def get_io_rate(self) -> dict:
         return self.get('io_rate')
 
+    def get_stats_per_pool(self) -> dict:
+        result = self.get('pg_dump')['pool_stats']
+
+        # collect application metadata from osd_map
+        osd_map = self.get('osd_map')
+        app_dict = {}
+        for pool in osd_map['pools']:
+            app_dict[pool['pool']] = pool['application_metadata']
+
+        # add application to each pool from pg_dump
+        for pool in result:
+            poolid = pool['poolid']
+            # Check that the pool has an application. If it does not,
+            # the application dict will be empty.
+            if app_dict[poolid]:
+                pool['application'] = list(app_dict[poolid].keys())[0]
+            else:
+                pool['application'] = ""
+
+        return result
+
     def gather_crashinfo(self) -> List[Dict[str, str]]:
         crashlist: List[Dict[str, str]] = list()
         errno, crashids, err = self.remote('crash', 'ls')
@@ -948,7 +969,7 @@ class Module(MgrModule):
 
         if 'perf' in channels:
             report['perf_counters'] = self.gather_perf_counters('separated')
-            report['stats_per_pool'] = self.get('pg_dump')['pool_stats']
+            report['stats_per_pool'] = self.get_stats_per_pool()
             report['stats_per_pg'] = self.get('pg_dump')['pg_stats']
             report['io_rate'] = self.get_io_rate()
             report['osd_perf_histograms'] = self.get_osd_histograms('separated')