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<std::string, OSDPerfMetricSubKeyType> 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<std::string, PerformanceCounterType> 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},
};
'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)
{'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):
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)'
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']: