]> 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, 1 Nov 2017 23:03:23 +0000 (23:03 +0000)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
(cherry picked from commit 76d1918724320b7d6b1120b57b3002bb24099001)

src/pybind/mgr/prometheus/module.py

index e18556a99c6ec8268ee35acbd00bc4261165108c..f1900bdeed08b60d36f550547a5fea1a886919b7 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']