From: Jan Fajerski Date: Wed, 9 Aug 2017 15:22:49 +0000 (+0200) Subject: pybind/mgr/prometheus: add device_class label to osd metrics X-Git-Tag: v12.2.2~61^2~82 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7f191ff9dff33cac551ae5f64027d566b17b6d98;p=ceph.git pybind/mgr/prometheus: add device_class label to osd metrics Signed-off-by: Jan Fajerski (cherry picked from commit 76d1918724320b7d6b1120b57b3002bb24099001) --- diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index e18556a99c6e..f1900bdeed08 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -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']