From: Jason Dillaman Date: Wed, 5 Dec 2018 18:24:23 +0000 (-0500) Subject: Merge pull request #25371 from trociny/wip-osd-query-subkey-types X-Git-Tag: v14.1.0~718 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=74d939799cb1ab4de3674ee47eff0b1ac370071c;p=ceph.git Merge pull request #25371 from trociny/wip-osd-query-subkey-types osd: support more dynamic perf query subkey types Reviewed-by: Jason Dillaman --- 74d939799cb1ab4de3674ee47eff0b1ac370071c diff --cc src/mgr/BaseMgrModule.cc index 8f209a8f30e3,fd5f2f53ecf2..7a86298c45ec --- a/src/mgr/BaseMgrModule.cc +++ b/src/mgr/BaseMgrModule.cc @@@ -683,24 -681,23 +683,29 @@@ ceph_add_osd_perf_query(BaseMgrModule * static const std::string NAME_KEY_DESCRIPTOR = "key_descriptor"; static const std::string NAME_COUNTERS_DESCRIPTORS = "performance_counter_descriptors"; + static const std::string NAME_LIMIT = "limit"; static const std::string NAME_SUB_KEY_TYPE = "type"; static const std::string NAME_SUB_KEY_REGEX = "regex"; + static const std::string NAME_LIMIT_ORDER_BY = "order_by"; + static const std::string NAME_LIMIT_MAX_COUNT = "max_count"; static const std::map sub_key_types = { {"client_id", OSDPerfMetricSubKeyType::CLIENT_ID}, + {"client_address", OSDPerfMetricSubKeyType::CLIENT_ADDRESS}, {"pool_id", OSDPerfMetricSubKeyType::POOL_ID}, + {"namespace", OSDPerfMetricSubKeyType::NAMESPACE}, + {"osd_id", OSDPerfMetricSubKeyType::OSD_ID}, + {"pg_id", OSDPerfMetricSubKeyType::PG_ID}, {"object_name", OSDPerfMetricSubKeyType::OBJECT_NAME}, + {"snap_id", OSDPerfMetricSubKeyType::SNAP_ID}, }; static const std::map counter_types = { + {"ops", PerformanceCounterType::OPS}, {"write_ops", PerformanceCounterType::WRITE_OPS}, {"read_ops", PerformanceCounterType::READ_OPS}, + {"bytes", PerformanceCounterType::BYTES}, {"write_bytes", PerformanceCounterType::WRITE_BYTES}, {"read_bytes", PerformanceCounterType::READ_BYTES}, + {"latency", PerformanceCounterType::LATENCY}, {"write_latency", PerformanceCounterType::WRITE_LATENCY}, {"read_latency", PerformanceCounterType::READ_LATENCY}, }; diff --cc src/pybind/mgr/mgr_module.py index f66ba6183469,c170e7ba0851..040833a6064f --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@@ -967,13 -967,14 +967,15 @@@ class MgrModule(ceph_module.BaseMgrModu 'performance_counter_descriptors': [ list, of, descriptor, types ], + 'limit': {'order_by': performance_counter_type, 'max_count': n}, } - Valid subkey types: 'client_id', 'pool_id', 'object_name' + Valid subkey types: + 'client_id', 'client_address', 'pool_id', 'namespace', 'osd_id', + 'pg_id', 'object_name', 'snap_id' Valid performance counter types: - 'write_ops', 'read_ops', 'write_bytes', 'read_bytes', - 'write_latency', 'read_latency' + 'ops', 'write_ops', 'read_ops', 'bytes', 'write_bytes', 'read_bytes', + 'latency', 'write_latency', 'read_latency' :param object query: query :rtype: int (query id) diff --cc src/pybind/mgr/osd_perf_query/module.py index 4e293b4e1a32,44f8e1192dd3..12660139dacd --- a/src/pybind/mgr/osd_perf_query/module.py +++ b/src/pybind/mgr/osd_perf_query/module.py @@@ -58,12 -58,27 +59,28 @@@ class OSDPerfQuery(MgrModule) {'type': 'object_name', 'regex': '^rbd_data\.([^.]+)\.'}, ], 'performance_counter_descriptors': [ - 'write_ops', 'read_ops', 'write_bytes', 'read_bytes', + 'bytes', 'write_ops', 'read_ops', 'write_bytes', 'read_bytes', 'write_latency', 'read_latency', ], + 'limit': {'order_by': 'bytes', 'max_count': 10}, } + ALL_SUBKEYS_QUERY = { + 'key_descriptor': [ + {'type': 'client_id', 'regex': '^.*$'}, + {'type': 'client_address', 'regex': '^.*$'}, + {'type': 'pool_id', 'regex': '^.*$'}, + {'type': 'namespace', 'regex': '^.*$'}, + {'type': 'osd_id', 'regex': '^.*$'}, + {'type': 'pg_id', 'regex': '^.*$'}, + {'type': 'object_name', 'regex': '^.*$'}, + {'type': 'snap_id', 'regex': '^.*$'}, + ], + 'performance_counter_descriptors': [ + 'write_ops', 'read_ops', + ], + } + queries = {} def handle_command(self, inbuf, cmd): @@@ -96,12 -113,10 +115,12 @@@ if query == self.RBD_IMAGE_ID_QUERY: column_names = ["pool_id", "rbd image_id"] else: - column_names = ["client_id"] + column_names = [sk['type'] for sk in query['key_descriptor']] for d in descriptors: desc = d - if d in ['write_bytes', 'read_bytes']: + if d in ['bytes']: + continue + elif d in ['write_bytes', 'read_bytes']: desc += '/sec' elif d in ['write_latency', 'read_latency']: desc += '(msec)' @@@ -121,12 -128,10 +140,12 @@@ if query == self.RBD_IMAGE_ID_QUERY: row = [c['k'][0][0], c['k'][1][1]] else: - row = [c['k'][0][0]] + row = [sk[0] for sk in c['k']] counters = c['c'] for i in range(len(descriptors)): - if descriptors[i] in ['write_bytes', 'read_bytes']: + if descriptors[i] in ['bytes']: + continue + elif descriptors[i] in ['write_bytes', 'read_bytes']: bps = counters[i][0] / (now - last_update) row.append(get_human_readable(bps)) elif descriptors[i] in ['write_latency', 'read_latency']: