]> 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>
Tue, 29 Oct 2019 19:46:53 +0000 (14:46 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
PendingReleaseNotes
src/pybind/mgr/telemetry/module.py

index ffa123806157c6b74fd85940cddf2d06e5ef630c..fae9df36040b7a9ca7276523d685cf8cec5964cd 100644 (file)
     - 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 b529be8b2392e47cf8efd7b370be6d14200426cc..2e725bceb3e93a512fb5f45c6eff6b88c044eade 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
@@ -349,6 +350,14 @@ class Module(MgrModule):
             res[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()
@@ -472,6 +481,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'],
@@ -482,6 +507,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'],