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: v13.0.2~804^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F19229%2Fhead;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 --- diff --git a/src/pybind/mgr/influx/module.py b/src/pybind/mgr/influx/module.py index beabce72d24..e5d787c6d5b 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'])