]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/prometheus: Cast collect_timeout (scrape_interval) to float 31107/head
authorBenjeman Meekhof <bmeekhof@users.noreply.github.com>
Mon, 29 Jul 2019 14:28:40 +0000 (10:28 -0400)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Thu, 24 Oct 2019 03:19:46 +0000 (10:19 +0700)
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)

Conflicts:
- path: src/pybind/mgr/prometheus/module.py
  comment: get_localized_module_option() in master, get_localized_config() in luminous

src/pybind/mgr/prometheus/module.py

index 880549526a32cb2d49fb3b264c9a041497cd7310..0fbe811ef6a6a820977410af52b0ce163aae8d0f 100644 (file)
@@ -676,7 +676,8 @@ class Module(MgrModule):
                     raise cherrypy.HTTPError(503, 'No MON connection')
 
         # Make the cache timeout for collecting configurable
-        self.collect_timeout = self.get_localized_config('scrape_interval', 5.0)
+        self.collect_timeout = float(self.get_localized_config(
+            'scrape_interval', 5.0))
 
         server_addr = self.get_localized_config('server_addr', DEFAULT_ADDR)
         server_port = self.get_localized_config('server_port', DEFAULT_PORT)