diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/pybind/mgr/stats/module.py | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/pybind/mgr/stats/module.py')
-rw-r--r-- | src/pybind/mgr/stats/module.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/pybind/mgr/stats/module.py b/src/pybind/mgr/stats/module.py new file mode 100644 index 000000000..fcc1bce97 --- /dev/null +++ b/src/pybind/mgr/stats/module.py @@ -0,0 +1,41 @@ +""" +performance stats for ceph filesystem (for now...) +""" + +import json +from typing import List, Dict + +from mgr_module import MgrModule, Option, NotifyType + +from .fs.perf_stats import FSPerfStats + +class Module(MgrModule): + COMMANDS = [ + { + "cmd": "fs perf stats " + "name=mds_rank,type=CephString,req=false " + "name=client_id,type=CephString,req=false " + "name=client_ip,type=CephString,req=false ", + "desc": "retrieve ceph fs performance stats", + "perm": "r" + }, + ] + MODULE_OPTIONS: List[Option] = [] + NOTIFY_TYPES = [NotifyType.command, NotifyType.fs_map] + + def __init__(self, *args, **kwargs): + super(Module, self).__init__(*args, **kwargs) + self.fs_perf_stats = FSPerfStats(self) + + def notify(self, notify_type: NotifyType, notify_id): + if notify_type == NotifyType.command: + self.fs_perf_stats.notify_cmd(notify_id) + elif notify_type == NotifyType.fs_map: + self.fs_perf_stats.notify_fsmap() + + def handle_command(self, inbuf, cmd): + prefix = cmd['prefix'] + # only supported command is `fs perf stats` right now + if prefix.startswith('fs perf stats'): + return self.fs_perf_stats.get_perf_data(cmd) + raise NotImplementedError(cmd['prefix']) |