Parcourir la source

[2136] Updated the do_polling method

A list of instances for stats to request is obtained from the show_processes
command of Boss instead of asking the components config of Boss.
Naoki Kambe il y a 12 ans
Parent
commit
6efc1e2e63
2 fichiers modifiés avec 10 ajouts et 11 suppressions
  1. 8 9
      src/bin/stats/stats.py.in
  2. 2 2
      src/bin/stats/tests/test_utils.py

+ 8 - 9
src/bin/stats/stats.py.in

@@ -179,20 +179,19 @@ class Stats:
            each module to invoke 'getstats'. Finally updates internal
            statistics data every time it gets from each instance."""
 
-        # count the number of instances of same module by examing
-        # 'components' of Boss via ConfigManager
+        # It counts the number of instances of same module by
+        # examining the third value from the array result of
+        # 'show_processes' of Boss
         seq = self.cc_session.group_sendmsg(
-            isc.config.ccsession.create_command(
-                isc.config.ccsession.COMMAND_GET_CONFIG,
-                {"module_name": "Boss"}), 'ConfigManager')
+            isc.config.ccsession.create_command("show_processes"),
+            'Boss')
         (answer, env) = self.cc_session.group_recvmsg(False, seq)
         modules = []
         if answer:
             (rcode, value) = isc.config.ccsession.parse_answer(answer)
-            if rcode == 0 and 'components' in value:
-                modules = [ c['special'].capitalize() \
-                                for c in value['components'].values() \
-                                if 'special' in c ]
+            if rcode == 0 and type(value) is list:
+                modules = [ v[2] if type(v) is list and len(v) > 2 \
+                                else None for v in value ]
         # start requesting each module to collect statistics data
         sequences = []
         for (module_name, data) in self.get_statistics_data().items():

+ 2 - 2
src/bin/stats/tests/test_utils.py

@@ -245,8 +245,8 @@ class MockBoss:
         self.spec_file.close()
         self.cc_session = self.mccs._session
         self.got_command_name = ''
-        self.pid_list = [[ 9999, "b10-auth"   ],
-                         [ 9998, "b10-auth-2" ]]
+        self.pid_list = [[ 9999, "b10-auth", "Auth" ],
+                         [ 9998, "b10-auth-2", "Auth" ]]
         self.statistics_data = {
             'boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', self._BASETIME)
             }