]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/prometheus: Cast collect_timeout (scrape_interval) to float 30007/head
authorBenjeman Meekhof <bmeekhof@users.noreply.github.com>
Mon, 29 Jul 2019 14:28:40 +0000 (10:28 -0400)
committerNathan Cutler <ncutler@suse.com>
Thu, 29 Aug 2019 13:42:26 +0000 (15:42 +0200)
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>
(cherry picked from commit 26a74a0d83e068b0bb762c4c7066b4b195187e94)

src/pybind/mgr/prometheus/module.py

index c215181540965bb4d6f0cc141a625552e037bced..f1c9370300555ba43207155e91e2abdd213d4ec0 100644 (file)
@@ -1072,8 +1072,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())