]> git-server-git.apps.pok.os.sepia.ceph.com Git - cephmetrics.git/commitdiff
rgw: handle the scenario where the socket doesn't respond
authorPaul Cuzner <pcuzner@redhat.com>
Mon, 21 Aug 2017 04:51:18 +0000 (16:51 +1200)
committerPaul Cuzner <pcuzner@redhat.com>
Mon, 21 Aug 2017 04:51:18 +0000 (16:51 +1200)
The perf dump to the socket could fail, so this change handles this
scenario by just reporting the issue avoiding connectionerror
problems

collectors/rgw.py

index 8a0095afe8b93c3594b1600306387e8f8afa220d..45f97495ccea37c1bc428b349b45ae5b6e85562b 100644 (file)
@@ -41,9 +41,12 @@ class RGW(BaseCollector):
 
         response = self._admin_socket()
 
-        key_name = 'client.rgw.{}'.format(self.host_name)
-
-        return response.get(key_name)
+        if response:
+            key_name = 'client.rgw.{}'.format(self.host_name)
+            return response.get(key_name)
+        else:
+            # admin_socket call failed
+            return {}
 
     def _filter(self, stats):
         # pick out the simple metrics
@@ -62,8 +65,10 @@ class RGW(BaseCollector):
         start = time.time()
 
         raw_stats = self._get_rgw_data()
-
-        stats = self._filter(raw_stats)
+        if raw_stats:
+            stats = self._filter(raw_stats)
+        else:
+            stats = {}
 
         stats['ceph_version'] = self.version