]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/stats/module.py
bump version to 18.2.4-pve3
[ceph.git] / ceph / src / pybind / mgr / stats / module.py
1 """
2 performance stats for ceph filesystem (for now...)
3 """
4
5 import json
6 from typing import List, Dict
7
8 from mgr_module import MgrModule, Option, NotifyType
9
10 from .fs.perf_stats import FSPerfStats
11
12 class Module(MgrModule):
13 COMMANDS = [
14 {
15 "cmd": "fs perf stats "
16 "name=mds_rank,type=CephString,req=false "
17 "name=client_id,type=CephString,req=false "
18 "name=client_ip,type=CephString,req=false ",
19 "desc": "retrieve ceph fs performance stats",
20 "perm": "r"
21 },
22 ]
23 MODULE_OPTIONS: List[Option] = []
24 NOTIFY_TYPES = [NotifyType.command, NotifyType.fs_map]
25
26 def __init__(self, *args, **kwargs):
27 super(Module, self).__init__(*args, **kwargs)
28 self.fs_perf_stats = FSPerfStats(self)
29
30 def notify(self, notify_type: NotifyType, notify_id):
31 if notify_type == NotifyType.command:
32 self.fs_perf_stats.notify_cmd(notify_id)
33 elif notify_type == NotifyType.fs_map:
34 self.fs_perf_stats.notify_fsmap()
35
36 def handle_command(self, inbuf, cmd):
37 prefix = cmd['prefix']
38 # only supported command is `fs perf stats` right now
39 if prefix.startswith('fs perf stats'):
40 return self.fs_perf_stats.get_perf_data(cmd)
41 raise NotImplementedError(cmd['prefix'])