]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/telemetry: add rgw metadata
authorAbhishek Lekshmanan <abhishek@suse.com>
Wed, 30 Oct 2019 20:34:43 +0000 (15:34 -0500)
committerJoao Eduardo Luis <joao@suse.com>
Thu, 12 Dec 2019 18:07:04 +0000 (18:07 +0000)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit f62c6e8cba2e894f84ddabdea6db4ce56e02ea63)

 Conflicts:
PendingReleaseNotes
          Dropped to prevent conflicts in the future
src/pybind/mgr/telemetry/module.py
            Context issues due to missing patches

src/pybind/mgr/telemetry/module.py

index e5ee3514ea919c163a40437a529e71aa1d23471c..ef680952d83639ced2c632d3e35332d7a4c24ea5 100644 (file)
@@ -50,6 +50,7 @@ REVISION = 2
 #   - added CephFS metadata (how many MDSs, fs features, how many data pools,
 #     how much metadata is cached)
 #   - added more pool metadata (rep vs ec, cache tiering mode, ec profile)
+#   - rgw daemons, zones, zonegroups; which rgw frontends
 
 class Module(MgrModule):
     config = dict()
@@ -424,6 +425,36 @@ class Module(MgrModule):
             report['services'] = defaultdict(int)
             for key, value in service_map['services'].items():
                 report['services'][key] += 1
+                if key == 'rgw':
+                    report['rgw'] = {
+                        'count': 0,
+                    }
+                    zones = set()
+                    realms = set()
+                    zonegroups = set()
+                    frontends = set()
+                    d = value.get('daemons', dict())
+
+                    for k,v in d.items():
+                        if k == 'summary' and v:
+                            report['rgw'][k] = v
+                        elif isinstance(v, dict) and 'metadata' in v:
+                            report['rgw']['count'] += 1
+                            zones.add(v['metadata']['zone_id'])
+                            zonegroups.add(v['metadata']['zonegroup_id'])
+                            frontends.add(v['metadata']['frontend_type#0'])
+
+                            # we could actually iterate over all the keys of
+                            # the dict and check for how many frontends there
+                            # are, but it is unlikely that one would be running
+                            # more than 2 supported ones
+                            f2 = v['metadata'].get('frontend_type#1', None)
+                            if f2:
+                                frontends.add(f2)
+
+                    report['rgw']['zones'] = len(zones)
+                    report['rgw']['zonegroups'] = len(zonegroups)
+                    report['rgw']['frontends'] = list(frontends)  # sets aren't json-serializable
 
         return report