]> git-server-git.apps.pok.os.sepia.ceph.com Git - cephmetrics.git/commitdiff
osd/rgw : write the elapsed time of get_stats to it's log file
authorPaul Cuzner <pcuzner@redhat.com>
Mon, 26 Jun 2017 05:13:23 +0000 (17:13 +1200)
committerPaul Cuzner <pcuzner@redhat.com>
Mon, 26 Jun 2017 05:13:23 +0000 (17:13 +1200)
collectors/osd.py
collectors/rgw.py

index eb16937b5040ae16fd8170a09689865274266a1c..809eb947520a2c5b7f61785bc76d3f38b24ce983 100644 (file)
@@ -67,9 +67,9 @@ class OSDs(BaseCollector):
         Grab the disk stats from /proc
         """
 
-        now = int(time.time())
-        interval = now - self.timestamp
-        self.timestamp = now
+        now = time.time()
+        interval = int(now) - self.timestamp
+        self.timestamp = int(now)
 
         for perf_entry in freadlines('/proc/diskstats'):
 
@@ -88,6 +88,9 @@ class OSDs(BaseCollector):
                 device.perf.compute(interval)
                 device.refresh()
 
+        end = time.time()
+        self.elapsed_log_msg("disk performance stats generation", (end - now))
+
     def dump(self):
 
         osd_info = {}
@@ -100,7 +103,13 @@ class OSDs(BaseCollector):
 
     def get_stats(self):
 
+        start = time.time()
+
         self._dev_to_osd()
         self._stats_lookup()
 
+        end = time.time()
+
+        self.elapsed_log_msg("osd get_stats call", (end - start))
+
         return self.dump()
index 201ab9750c738cbf0f807fda9a509edefcae238f..adceae2e30120bc38426d2677f492e021e57cd18 100644 (file)
@@ -1,5 +1,7 @@
 #!/usr/bin/env python
 
+import time
+
 from collectors.base import BaseCollector
 from collectors.common import get_hostname, merge_dicts
 
@@ -59,8 +61,14 @@ class RGW(BaseCollector):
 
     def get_stats(self):
 
+        start = time.time()
+
         raw_stats = self._get_rgw_data()
 
         stats = self._filter(raw_stats)
 
+        end = time.time()
+
+        self.elapsed_log_msg("RGW get_stats", (end - start))
+
         return {"rgw": stats}