From: Wido den Hollander Date: Mon, 11 Dec 2017 14:44:05 +0000 (+0100) Subject: mgr/influx: Print (in debug) time it takes to send data to Influx X-Git-Tag: v12.2.6~32^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2f192b1538c69e9b213d178ec4f083b37f90a84f;p=ceph.git mgr/influx: Print (in debug) time it takes to send data to Influx 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 (cherry picked from commit 3f07636bc235ace8da3f2f07aefd56e53085ea0e) --- diff --git a/src/pybind/mgr/influx/module.py b/src/pybind/mgr/influx/module.py index 9cd33ed167ba..4c22c609c659 100644 --- a/src/pybind/mgr/influx/module.py +++ b/src/pybind/mgr/influx/module.py @@ -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'])