From: Benjeman Meekhof Date: Mon, 29 Jul 2019 14:28:40 +0000 (-0400) Subject: mgr/prometheus: Cast collect_timeout (scrape_interval) to float X-Git-Tag: v15.1.0~1951^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=26a74a0d83e068b0bb762c4c7066b4b195187e94;p=ceph.git mgr/prometheus: Cast collect_timeout (scrape_interval) to float 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 --- diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index c1db56c00df1..a59e4773ee37 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -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())