]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/prometheus: add device_class label to osd metrics
authorJan Fajerski <jfajerski@suse.com>
Wed, 9 Aug 2017 15:22:49 +0000 (17:22 +0200)
committerJohn Spray <john.spray@redhat.com>
Wed, 27 Sep 2017 18:17:59 +0000 (14:17 -0400)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
src/pybind/mgr/prometheus/module.py

index 34f828fff53e1333be24d34e246d87258e8d8e9c..2b8fb064d18ee60dd94ce7f279014582aa54c549 100644 (file)
@@ -300,16 +300,17 @@ class Module(MgrModule):
     def get_osd_status(self):
         '''TODO add device_class label!!!'''
         osd_status = self.get('osd_stats')['osd_stats']
-        osd_devs = self.get('osd_metadata')
+        osd_dev = self.get('osd_map_crush')['devices']
         for osd in osd_status:
             id_ = osd['osd']
-            dev_class = :q
+            dev_class = next((osd for osd in osd_dev if osd['id'] == id_))
             for stat in OSD_STATS:
                 path = 'osd_{}'.format(stat)
-                self.metrics[path].set(osd[stat], (id_,))
-            for p_stat in OSD_PERF_STAT:
-                path = 'osd_{}'.format(stat)
-                self.metrics[path].set(osd['perf_stat'][stat], (id_,))
+                self.metrics[path].set(osd[stat], (id_,dev_class['class']))
+            for p_stat in OSD_PERF_STATS:
+                path = 'osd_{}'.format(p_stat)
+                self.metrics[path].set(osd['perf_stat'][p_stat],
+                                       (id_,dev_class['class']))
 
     def get_pg_status(self):
         pg_s = self.get('pg_summary')['by_osd']