]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
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 | |
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 | ||
25 | def __init__(self, *args, **kwargs): | |
26 | super(Module, self).__init__(*args, **kwargs) | |
27 | self.fs_perf_stats = FSPerfStats(self) | |
28 | ||
29 | def notify(self, notify_type, notify_id): | |
30 | if notify_type == "command": | |
31 | self.fs_perf_stats.notify(notify_id) | |
32 | ||
33 | def handle_command(self, inbuf, cmd): | |
34 | prefix = cmd['prefix'] | |
35 | # only supported command is `fs perf stats` right now | |
36 | if prefix.startswith('fs perf stats'): | |
37 | return self.fs_perf_stats.get_perf_data(cmd) | |
38 | raise NotImplementedError(cmd['prefix']) |