]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/prometheus: Cast collect_timeout (scrape_interval) to float
authorBenjeman Meekhof <bmeekhof@users.noreply.github.com>
Mon, 29 Jul 2019 14:28:40 +0000 (10:28 -0400)
committerBenjeman Meekhof <bmeekhof@users.noreply.github.com>
Mon, 29 Jul 2019 14:52:35 +0000 (10:52 -0400)
If set by user scrape_interval option is returned as non-float by get_localized_module_option.
Metric cache timeout comparison always returns true and data is never refreshed.

Fixes: https://tracker.ceph.com/issues/40997
Signed-off-by: Ben Meekhof <bmeekhof@umich.edu>
src/pybind/mgr/prometheus/module.py

index c1db56c00df11859233c3e92583ed580183a4e97..a59e4773ee37bb0b6c5ad599a5f38442fdb1226a 100644 (file)
@@ -1061,8 +1061,8 @@ class Module(MgrModule):
                     raise cherrypy.HTTPError(503, 'No MON connection')
 
         # Make the cache timeout for collecting configurable
-        self.collect_timeout = self.get_localized_module_option(
-            'scrape_interval', 5.0)
+        self.collect_timeout = float(self.get_localized_module_option(
+            'scrape_interval', 5.0))
 
         server_addr = self.get_localized_module_option(
             'server_addr', get_default_addr())