]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: prometheus: added osd commit/apply latency metrics (#22718). 20084/head
authorKonstantin Shalygin <k0ste@k0ste.ru>
Wed, 17 Jan 2018 06:40:05 +0000 (13:40 +0700)
committerPrashant D <pdhange@redhat.com>
Wed, 24 Jan 2018 00:14:07 +0000 (19:14 -0500)
Signed-off-by: Konstantin Shalygin <k0ste@k0ste.ru>
(cherry picked from commit 1adf4325455ccdbf03da63046c510bb041ac8520)

src/pybind/mgr/prometheus/module.py

index 07f53a6373915521077686f4335029031256b6f5..49c957de9ee76e2ec37da3a2e6f491d2266af4af 100644 (file)
@@ -56,6 +56,8 @@ OSD_METADATA = ('cluster_addr', 'device_class', 'id', 'public_addr')
 
 OSD_STATUS = ['weight', 'up', 'in']
 
+OSD_STATS = ['apply_latency_ms', 'commit_latency_ms']
+
 POOL_METADATA = ('pool_id', 'name')
 
 DISK_OCCUPATION = ('instance', 'device', 'ceph_daemon')
@@ -202,6 +204,15 @@ class Module(MgrModule):
                 'OSD status {}'.format(state),
                 ('ceph_daemon',)
             )
+        for stat in OSD_STATS:
+            path = 'osd_{}'.format(stat)
+            self.log.debug("init: creating {}".format(path))
+            metrics[path] = Metric(
+                'gauge',
+                path,
+                'OSD stat {}'.format(stat),
+                ('ceph_daemon',)
+            )
         for state in PG_STATES:
             path = 'pg_{}'.format(state)
             self.log.debug("init: creating {}".format(path))
@@ -276,6 +287,16 @@ class Module(MgrModule):
                 except KeyError:
                     self.log.warn("skipping pg in unknown state {}".format(state))
 
+    def get_osd_stats(self):
+        osd_stats = self.get('osd_stats')
+        for osd in osd_stats['osd_stats']:
+            id_ = osd['osd']
+            for stat in OSD_STATS:
+                status = osd['perf_stat'][stat]
+                self.metrics['osd_{}'.format(stat)].set(
+                    status,
+                    ('osd.{}'.format(id_),))
+
     def get_metadata_and_osd_status(self):
         osd_map = self.get('osd_map')
         osd_devices = self.get('osd_map_crush')['devices']
@@ -325,6 +346,7 @@ class Module(MgrModule):
     def collect(self):
         self.get_health()
         self.get_df()
+        self.get_osd_stats()
         self.get_quorum_status()
         self.get_metadata_and_osd_status()
         self.get_pg_status()