]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/influx: Print (in debug) time it takes to send data to Influx
authorWido den Hollander <wido@42on.com>
Mon, 11 Dec 2017 14:44:05 +0000 (15:44 +0100)
committerWido den Hollander <wido@42on.com>
Wed, 6 Jun 2018 13:49:41 +0000 (15:49 +0200)
On large clusters it might take a very long time to send data to Influx
due to the gathering and parsing of statistics.

By keeping a counter and printing it admins can adjust the interval if it
becomes to heavy for their cluster.

Signed-off-by: Wido den Hollander <wido@42on.com>
(cherry picked from commit 3f07636bc235ace8da3f2f07aefd56e53085ea0e)

src/pybind/mgr/influx/module.py

index 9cd33ed167baacb2bd2c2ffca74a5c113e7eb138..4c22c609c65928a7285f68e9f06202c7021a1a00 100644 (file)
@@ -2,6 +2,7 @@ from datetime import datetime
 from threading import Event
 import json
 import errno
+import time
 
 from mgr_module import MgrModule
 
@@ -163,6 +164,8 @@ class Module(MgrModule):
 
         # If influx server has authentication turned off then
         # missing username/password is valid.
+        self.log.debug("Sending data to Influx host: %s",
+                       self.config['hostname'])
         client = InfluxDBClient(self.config['hostname'], self.config['port'],
                                 self.config['username'],
                                 self.config['password'],
@@ -232,7 +235,10 @@ class Module(MgrModule):
         self.run = True
 
         while self.run:
+            start = time.time()
             self.send_to_influx()
-            self.log.debug("Running interval loop")
-            self.log.debug("sleeping for %d seconds", self.config['interval'])
+            runtime = time.time() - start
+            self.log.debug('Finished sending data in Influx in %.3f seconds',
+                           runtime)
+            self.log.debug("Sleeping for %d seconds", self.config['interval'])
             self.event.wait(self.config['interval'])