]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/telemetry: mds cache stats
authorSage Weil <sage@redhat.com>
Tue, 29 Oct 2019 18:53:50 +0000 (13:53 -0500)
committerSage Weil <sage@redhat.com>
Wed, 6 Nov 2019 12:41:50 +0000 (06:41 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit f4c736699478f608bba77770a85f96a7bf8d24e5)

PendingReleaseNotes
src/pybind/mgr/telemetry/module.py

index 13062a1ad2d2a5ac89f75981b5f26fac3cde6ad5..cacc6b9436fc6311e0dc2251ff5ef49a6f81062f 100644 (file)
@@ -54,6 +54,7 @@
     - which features are (or have been) enabled
     - how many data pools
     - approximate file system age (year + month of creation)
+    - how much metadata is being cached per file system
 
   We have also added:
 
index fd22bc6d00b7c85455945a61e5b1e2e861640409..ae52ba28365283fd3e06bb09c2f41625f6a22fac 100644 (file)
@@ -49,8 +49,9 @@ REVISION = 3
 #
 # Version 3:
 #   - added device health metrics (i.e., SMART data, minus serial number)
-#   - added CephFS metadata (how many MDSs, fs features, how many data pools)
 #   - remove crush_rule
+#   - 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)
 #   - added host count, and counts for hosts with each of (mon, osd, mds, mgr)
 #   - whether an OSD cluster network is in use
@@ -362,6 +363,14 @@ class Module(MgrModule):
             res[anon_host][anon_devid] = m
         return res
 
+    def get_latest(self, daemon_type, daemon_name, stat):
+        data = self.get_counter(daemon_type, daemon_name, stat)[stat]
+        #self.log.error("get_latest {0} data={1}".format(stat, data))
+        if data:
+            return data[-1][1]
+        else:
+            return 0
+
     def compile_report(self, channels=[]):
         if not channels:
             channels = self.get_active_channels()
@@ -485,6 +494,22 @@ class Module(MgrModule):
             num_mds = len(fs_map['standbys'])
             for fsm in fs_map['filesystems']:
                 fs = fsm['mdsmap']
+                num_sessions = 0
+                cached_ino = 0
+                cached_dn = 0
+                cached_cap = 0
+                subtrees = 0
+                for gid, mds in fs['info'].items():
+                    num_sessions += self.get_latest('mds', mds['name'],
+                                                    'mds_sessions.session_count')
+                    cached_ino += self.get_latest('mds', mds['name'],
+                                                  'mds_mem.ino')
+                    cached_dn += self.get_latest('mds', mds['name'],
+                                                 'mds_mem.dn')
+                    cached_cap += self.get_latest('mds', mds['name'],
+                                                  'mds_mem.cap')
+                    subtrees += self.get_latest('mds', mds['name'],
+                                                'mds.subtrees')
                 report['fs']['filesystems'].append({
                     'max_mds': fs['max_mds'],
                     'ever_allowed_features': fs['ever_allowed_features'],
@@ -495,6 +520,11 @@ class Module(MgrModule):
                         [mds for gid, mds in fs['info'].items()
                          if mds['state'] == 'up:standby-replay']),
                     'num_mds': len(fs['info']),
+                    'num_sessions': num_sessions,
+                    'cached_inos': cached_ino,
+                    'cached_dns': cached_dn,
+                    'cached_caps': cached_cap,
+                    'cached_subtrees': subtrees,
                     'balancer_enabled': len(fs['balancer']) > 0,
                     'num_data_pools': len(fs['data_pools']),
                     'standby_count_wanted': fs['standby_count_wanted'],