]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr/prometheus: PEP8 cleanups
authorSage Weil <sage@newdream.net>
Tue, 16 Mar 2021 13:00:42 +0000 (08:00 -0500)
committerSage Weil <sage@newdream.net>
Tue, 16 Mar 2021 13:00:42 +0000 (08:00 -0500)
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit e69aad6c6191d0ff3288ae666a306d1c66f1039a)

# Conflicts:
# src/pybind/mgr/tox.ini
  - pacific telemetry not in tox.ini

src/pybind/mgr/prometheus/__init__.py
src/pybind/mgr/prometheus/module.py
src/pybind/mgr/tox.ini

index 763a84261e6e94bed099ad40d90205c07fe2b0e5..d39184947b44ae882779b3e00a06b1b4cab158af 100644 (file)
@@ -1,2 +1 @@
 from .module import Module, StandbyModule
-
index 99b685501911f8c9bac672c92461ae9ec999a287..adf69adcf0a77e60a3b5199188db4d4a3a5834f5 100644 (file)
@@ -116,7 +116,7 @@ NUM_OBJECTS = ['degraded', 'misplaced', 'unfound']
 
 alert_metric = namedtuple('alert_metric', 'name description')
 HEALTH_CHECKS = [
-    alert_metric('SLOW_OPS', 'OSD or Monitor requests taking a long time to process' ),
+    alert_metric('SLOW_OPS', 'OSD or Monitor requests taking a long time to process'),
 ]
 
 
@@ -266,6 +266,7 @@ class MetricCollectionThread(threading.Thread):
         self.active = False
         self.event.set()
 
+
 class Module(MgrModule):
     COMMANDS = [
         {
@@ -541,11 +542,14 @@ class Module(MgrModule):
                     v, err = 0, 0
 
                     if check.name == "SLOW_OPS":
-                        # 42 slow ops, oldest one blocked for 12 sec, daemons [osd.0, osd.3] have slow ops.
+                        # 42 slow ops, oldest one blocked for 12 sec, daemons [osd.0, osd.3] have
+                        # slow ops.
                         v, err = _get_value(message)
 
                     if err:
-                        self.log.error("healthcheck {} message format is incompatible and has been dropped".format(check.name))
+                        self.log.error(
+                            "healthcheck %s message format is incompatible and has been dropped",
+                            check.name)
                         # drop the metric, so it's no longer emitted
                         del self.metrics[path]
                         continue
@@ -644,7 +648,8 @@ class Module(MgrModule):
         all_mgrs = list(standbys)
         all_mgrs.append(active)
 
-        all_modules = {module.get('name'):module.get('can_run') for module in mgr_map['available_modules']}
+        all_modules = {module.get('name'): module.get('can_run')
+                       for module in mgr_map['available_modules']}
 
         for mgr in all_mgrs:
             host_version = servers.get((mgr, 'mgr'), ('', ''))
@@ -1329,7 +1334,8 @@ class Module(MgrModule):
         # Make the cache timeout for collecting configurable
         self.scrape_interval = cast(float, self.get_localized_module_option('scrape_interval'))
 
-        self.stale_cache_strategy = cast(str, self.get_localized_module_option('stale_cache_strategy'))
+        self.stale_cache_strategy = cast(
+            str, self.get_localized_module_option('stale_cache_strategy'))
         if self.stale_cache_strategy not in [self.STALE_CACHE_FAIL,
                                              self.STALE_CACHE_RETURN]:
             self.stale_cache_strategy = self.STALE_CACHE_FAIL
index 07368846a727d129aadc1cc297bc75d612c4d170..4835fa1157a99a75a6a6b787ed8e0b226104ef89 100644 (file)
@@ -98,6 +98,7 @@ deps =
 modules =
     cephadm
     orchestrator
+    prometheus
 commands =
     flake8 --config=tox.ini {posargs} \
       {posargs:{[testenv:flake8]modules}}