.. automethod:: MgrModule.list_servers
.. automethod:: MgrModule.get_metadata
.. automethod:: MgrModule.get_daemon_status
-.. automethod:: MgrModule.get_perf_schema
-.. automethod:: MgrModule.get_counter
+.. automethod:: MgrModule.get_unlabeled_perf_schema
+.. automethod:: MgrModule.get_unlabeled_counter
+.. automethod:: MgrModule.get_latest_unlabeled_counter
.. automethod:: MgrModule.get_mgr_id
.. automethod:: MgrModule.get_daemon_health_metrics
}
}
-PyObject* ActivePyModules::with_perf_counters(
+PyObject* ActivePyModules::with_unlabled_perf_counters(
std::function<void(PerfCounterInstance& counter_instance, PerfCounterType& counter_type, PyFormatter& f)> fct,
const std::string &svc_name,
const std::string &svc_id,
return f.get();
}
-PyObject* ActivePyModules::get_counter_python(
+PyObject* ActivePyModules::get_unlabeled_counter_python(
const std::string &svc_name,
const std::string &svc_id,
const std::string &path)
}
}
};
- return with_perf_counters(extract_counters, svc_name, svc_id, path);
+ return with_unlabled_perf_counters(extract_counters, svc_name, svc_id, path);
}
-PyObject* ActivePyModules::get_latest_counter_python(
+PyObject* ActivePyModules::get_latest_unlabeled_counter_python(
const std::string &svc_name,
const std::string &svc_id,
const std::string &path)
f.dump_unsigned("v", datapoint.v);
}
};
- return with_perf_counters(extract_latest_counters, svc_name, svc_id, path);
+ return with_unlabled_perf_counters(extract_latest_counters, svc_name, svc_id, path);
}
-PyObject* ActivePyModules::get_perf_schema_python(
+PyObject* ActivePyModules::get_unlabeled_perf_schema_python(
const std::string &svc_type,
const std::string &svc_id)
{
const std::string &svc_type, const std::string &svc_id);
PyObject *get_daemon_status_python(
const std::string &svc_type, const std::string &svc_id);
- PyObject *get_counter_python(
+ PyObject *get_unlabeled_counter_python(
const std::string &svc_type,
const std::string &svc_id,
const std::string &path);
- PyObject *get_latest_counter_python(
+ PyObject *get_latest_unlabeled_counter_python(
const std::string &svc_type,
const std::string &svc_id,
const std::string &path);
- PyObject *get_perf_schema_python(
+ PyObject *get_unlabeled_perf_schema_python(
const std::string &svc_type,
const std::string &svc_id);
PyObject *get_rocksdb_version();
PyObject *get_context();
PyObject *get_osdmap();
/// @note @c fct is not allowed to acquire locks when holding GIL
- PyObject *with_perf_counters(
+ PyObject *with_unlabled_perf_counters(
std::function<void(
PerfCounterInstance& counter_instance,
PerfCounterType& counter_type,
}
static PyObject*
-get_counter(BaseMgrModule *self, PyObject *args)
+get_unlabeled_counter(BaseMgrModule *self, PyObject *args)
{
char *svc_name = nullptr;
char *svc_id = nullptr;
char *counter_path = nullptr;
- if (!PyArg_ParseTuple(args, "sss:get_counter", &svc_name,
+ if (!PyArg_ParseTuple(args, "sss:get_unlabeled_counter", &svc_name,
&svc_id, &counter_path)) {
return nullptr;
}
- return self->py_modules->get_counter_python(
+ return self->py_modules->get_unlabeled_counter_python(
svc_name, svc_id, counter_path);
}
static PyObject*
-get_latest_counter(BaseMgrModule *self, PyObject *args)
+get_latest_unlabeled_counter(BaseMgrModule *self, PyObject *args)
{
char *svc_name = nullptr;
char *svc_id = nullptr;
char *counter_path = nullptr;
- if (!PyArg_ParseTuple(args, "sss:get_counter", &svc_name,
+ if (!PyArg_ParseTuple(args, "sss:get_latest_unlabeled_counter", &svc_name,
&svc_id, &counter_path)) {
return nullptr;
}
- return self->py_modules->get_latest_counter_python(
+ return self->py_modules->get_latest_unlabeled_counter_python(
svc_name, svc_id, counter_path);
}
static PyObject*
-get_perf_schema(BaseMgrModule *self, PyObject *args)
+get_unlabeled_perf_schema(BaseMgrModule *self, PyObject *args)
{
char *type_str = nullptr;
char *svc_id = nullptr;
- if (!PyArg_ParseTuple(args, "ss:get_perf_schema", &type_str,
+ if (!PyArg_ParseTuple(args, "ss:get_unlabeled_perf_schema", &type_str,
&svc_id)) {
return nullptr;
}
- return self->py_modules->get_perf_schema_python(type_str, svc_id);
+ return self->py_modules->get_unlabeled_perf_schema_python(type_str, svc_id);
}
static PyObject*
{"_ceph_set_store", (PyCFunction)ceph_store_set, METH_VARARGS,
"Set a stored field"},
- {"_ceph_get_counter", (PyCFunction)get_counter, METH_VARARGS,
+ {"_ceph_get_unlabeled_counter", (PyCFunction)get_unlabeled_counter, METH_VARARGS,
"Get a performance counter"},
- {"_ceph_get_latest_counter", (PyCFunction)get_latest_counter, METH_VARARGS,
+ {"_ceph_get_latest_unlabeled_counter", (PyCFunction)get_latest_unlabeled_counter, METH_VARARGS,
"Get the latest performance counter"},
- {"_ceph_get_perf_schema", (PyCFunction)get_perf_schema, METH_VARARGS,
- "Get the performance counter schema"},
+ {"_ceph_get_unlabeled_perf_schema", (PyCFunction)get_unlabeled_perf_schema, METH_VARARGS,
+ "Get the unlabeled performance counter schema"},
{"_ceph_get_rocksdb_version", (PyCFunction)ceph_get_rocksdb_version, METH_NOARGS,
"Get the current RocksDB version number"},
def _ceph_notify_all(self, what: str, tag: str) -> None: ...
def _ceph_get_server(self, hostname: Optional[str]) -> Union[ServerInfoT,
List[ServerInfoT]]: ...
- def _ceph_get_perf_schema(self, svc_type: str, svc_name: str) -> Dict[str, Any]: ...
+ def _ceph_get_unlabeled_perf_schema(self, svc_type: str, svc_name: str) -> Dict[str, Any]: ...
def _ceph_get_rocksdb_version(self) -> str: ...
- def _ceph_get_counter(self, svc_type: str, svc_name: str, path: str) -> Dict[str, List[Tuple[float, int]]]: ...
+ def _ceph_get_unlabeled_counter(self, svc_type: str, svc_name: str, path: str) -> Dict[str, List[Tuple[float, int]]]: ...
+ def _ceph_get_latest_unlabeled_counter(self, svc_type, svc_name, path): ...
def _ceph_get_latest_counter(self, svc_type, svc_name, path): ...
def _ceph_get_metadata(self, svc_type, svc_id): ...
def _ceph_get_daemon_status(self, svc_type, svc_id): ...
for mds_name in mds_names:
result[mds_name] = {}
for counter in counters:
- data = mgr.get_counter("mds", mds_name, counter)
+ data = mgr.get_unlabeled_counter("mds", mds_name, counter)
if data is not None:
result[mds_name][counter] = data[counter]
else:
if daemon_info['state'] != "up:standby-replay":
continue
- inos = mgr.get_latest("mds", daemon_info['name'], "mds_mem.ino")
- dns = mgr.get_latest("mds", daemon_info['name'], "mds_mem.dn")
- dirs = mgr.get_latest("mds", daemon_info['name'], "mds_mem.dir")
- caps = mgr.get_latest("mds", daemon_info['name'], "mds_mem.cap")
+ inos = mgr.get_unlabeled_counter_latest("mds", daemon_info['name'], "mds_mem.ino")
+ dns = mgr.get_unlabeled_counter_latest("mds", daemon_info['name'], "mds_mem.dn")
+ dirs = mgr.get_unlabeled_counter_latest("mds", daemon_info['name'], "mds_mem.dir")
+ caps = mgr.get_unlabeled_counter_latest("mds", daemon_info['name'], "mds_mem.cap")
activity = CephService.get_rate(
"mds", daemon_info['name'], "mds_log.replay")
if up:
gid = mdsmap['up']["mds_{0}".format(rank)]
info = mdsmap['info']['gid_{0}'.format(gid)]
- dns = mgr.get_latest("mds", info['name'], "mds_mem.dn")
- inos = mgr.get_latest("mds", info['name'], "mds_mem.ino")
- dirs = mgr.get_latest("mds", info['name'], "mds_mem.dir")
- caps = mgr.get_latest("mds", info['name'], "mds_mem.cap")
+ dns = mgr.get_unlabeled_counter_latest("mds", info['name'], "mds_mem.dn")
+ inos = mgr.get_unlabeled_counter_latest("mds", info['name'], "mds_mem.ino")
+ dirs = mgr.get_unlabeled_counter_latest("mds", info['name'], "mds_mem.dir")
+ caps = mgr.get_unlabeled_counter_latest("mds", info['name'], "mds_mem.cap")
# In case rank 0 was down, look at another rank's
# sessionmap to get an indication of clients.
if rank == 0 or client_count == 0:
- client_count = mgr.get_latest("mds", info['name'],
- "mds_sessions.session_count")
+ client_count = mgr.get_unlabeled_counter_latest(
+ "mds", info["name"], "mds_sessions.session_count"
+ )
laggy = "laggy_since" in info
for mon in mon_status["monmap"]["mons"]:
mon["stats"] = {}
for counter in counters:
- data = mgr.get_counter("mon", mon["name"], counter)
+ data = mgr.get_unlabeled_counter("mon", mon["name"], counter)
if data is not None:
mon["stats"][counter.split(".")[1]] = data[counter]
else:
osd['stats_history'][prop] = rates
# Gauge stats
for stat in ['osd.numpg', 'osd.stat_bytes', 'osd.stat_bytes_used']:
- osd['stats'][stat.split('.')[1]] = mgr.get_latest('osd', osd_spec, stat)
+ osd["stats"][stat.split(".")[1]] = mgr.get_unlabeled_counter_latest(
+ "osd", osd_spec, stat
+ )
@RESTController.Collection('GET', version=APIVersion.EXPERIMENTAL)
@ReadPermission
@classmethod
def get_service_perf_counters(cls, service_type: str, service_id: str) -> Dict[str, Any]:
- schema_dict = mgr.get_perf_schema(service_type, service_id)
+ schema_dict = mgr.get_unlabeled_perf_schema(service_type, service_id)
schema = schema_dict["{}.{}".format(service_type, service_id)]
counters = []
for key, value in sorted(schema.items()):
service_type, service_id, key)
counter['unit'] = mgr._unit_to_str(value['units'])
else:
- counter['value'] = mgr.get_latest(
+ counter['value'] = mgr.get_unlabeled_counter_latest(
service_type, service_id, key)
counter['unit'] = ''
counters.append(counter)
@classmethod
def get_rates(cls, svc_type, svc_name, path):
"""
- :return: the derivative of mgr.get_counter()
+ :return: the derivative of mgr.get_unlabeled_counter()
:rtype: list[tuple[int, float]]"""
- data = mgr.get_counter(svc_type, svc_name, path)[path]
+ data = mgr.get_unlabeled_counter(svc_type, svc_name, path)[path]
return get_time_series_rates(data)
@classmethod
pool=metadata['pool_name'],
name=metadata['image_name'])
perf_key = "{}lock_acquired_time".format(perf_key_prefix)
- perf_value = mgr.get_counter('tcmu-runner',
- service_id,
- perf_key)[perf_key]
+ perf_value = mgr.get_unlabeled_counter("tcmu-runner", service_id, perf_key)[
+ perf_key
+ ]
if perf_value:
lock_acquired_time = perf_value[-1][1] / 1000000000
else:
with mock.patch.object(Osd, 'get_osd_map', return_value=OsdHelper.gen_osdmap(osdmap_ids)):
with mock.patch.object(mgr, 'get', side_effect=mgr_get_replacement):
- with mock.patch.object(mgr, 'get_counter', side_effect=mgr_get_counter_replacement):
- with mock.patch.object(mgr, 'get_latest', return_value=1146609664):
+ with mock.patch.object(
+ mgr, "get_unlabeled_counter", side_effect=mgr_get_counter_replacement
+ ):
+ with mock.patch.object(
+ mgr, "get_unlabeled_counter_latest", return_value=1146609664
+ ):
with mock.patch.object(Osd, 'get_removing_osds', return_value=[]):
yield
finally:
self.queue.task_done()
- def get_latest(self, daemon_type: str, daemon_name: str, stat: str) -> int:
- data = self.get_counter(daemon_type, daemon_name, stat)[stat]
+ def get_unlabeled_counter_latest(self, daemon_type: str, daemon_name: str, stat: str) -> int:
+ data = self.get_unlabeled_counter(daemon_type, daemon_name, stat)[stat]
if data:
return data[-1][1]
for osd in osd_map["osds"]:
osd['stats'] = {}
for s in ['osd.numpg', 'osd.stat_bytes', 'osd.stat_bytes_used']:
- osd['stats'][s.split('.')[1]] = self.get_latest('osd', str(osd["osd"]), s)
+ osd['stats'][s.split('.')[1]] = self.get_unlabeled_counter_latest('osd', str(osd["osd"]), s)
def _config_dump(self):
"""Report cluster configuration
return cast(ServerInfoT, self._ceph_get_server(hostname))
@API.expose
- def get_perf_schema(self,
- svc_type: str,
- svc_name: str) -> Dict[str,
- Dict[str, Dict[str, Union[str, int]]]]:
+ def get_unlabeled_perf_schema(
+ self, svc_type: str, svc_name: str
+ ) -> Dict[str, Dict[str, Dict[str, Union[str, int]]]]:
"""
Called by the plugin to fetch perf counter schema info.
svc_name can be nullptr, as can svc_type, in which case
:param str svc_name:
:return: list of dicts describing the counters requested
"""
- return self._ceph_get_perf_schema(svc_type, svc_name)
+ return self._ceph_get_unlabeled_perf_schema(svc_type, svc_name)
def get_rocksdb_version(self) -> str:
"""
return self._ceph_get_rocksdb_version()
@API.expose
- def get_counter(self,
- svc_type: str,
- svc_name: str,
- path: str) -> Dict[str, List[Tuple[float, int]]]:
+ def get_unlabeled_counter(
+ self, svc_type: str, svc_name: str, path: str
+ ) -> Dict[str, List[Tuple[float, int]]]:
"""
Called by the plugin to fetch the latest performance counter data for a
particular counter on a particular service.
of two-tuples of (timestamp, value). This may be empty if no data is
available.
"""
- return self._ceph_get_counter(svc_type, svc_name, path)
+ return self._ceph_get_unlabeled_counter(svc_type, svc_name, path)
@API.expose
- def get_latest_counter(self,
- svc_type: str,
- svc_name: str,
- path: str) -> Dict[str, Union[Tuple[float, int],
- Tuple[float, int, int]]]:
+ def get_latest_unlabeled_counter(
+ self, svc_type: str, svc_name: str, path: str
+ ) -> Dict[str, Union[Tuple[float, int], Tuple[float, int, int]]]:
"""
Called by the plugin to fetch only the newest performance counter data
point for a particular counter on a particular service.
(timestamp, value, count) is returned. This may be empty if no
data is available.
"""
- return self._ceph_get_latest_counter(svc_type, svc_name, path)
+ return self._ceph_get_latest_unlabeled_counter(svc_type, svc_name, path)
@API.expose
def list_servers(self) -> List[ServerInfoT]:
return cast(OSDMap, self._ceph_get_osdmap())
@API.expose
- def get_latest(self, daemon_type: str, daemon_name: str, counter: str) -> int:
- data = self.get_latest_counter(
+ def get_unlabeled_counter_latest(self, daemon_type: str, daemon_name: str, counter: str) -> int:
+ data = self.get_latest_unlabeled_counter(
daemon_type, daemon_name, counter)[counter]
if data:
return data[1]
return 0
@API.expose
- def get_latest_avg(self, daemon_type: str, daemon_name: str, counter: str) -> Tuple[int, int]:
- data = self.get_latest_counter(
+ def get_unlabeled_counter_latest_avg(self, daemon_type: str, daemon_name: str, counter: str) -> Tuple[int, int]:
+ data = self.get_latest_unlabeled_counter(
daemon_type, daemon_name, counter)[counter]
if data:
# https://github.com/python/mypy/issues/1178
if service['type'] not in services:
continue
- schemas = self.get_perf_schema(service['type'], service['id'])
+ schemas = self.get_unlabeled_perf_schema(service['type'], service['id'])
if not schemas:
self.log.warning("No perf counter schema for {0}.{1}".format(
service['type'], service['id']
counter_info = dict(counter_schema)
# Also populate count for the long running avgs
if tp & self.PERFCOUNTER_LONGRUNAVG:
- v, c = self.get_latest_avg(
+ v, c = self.get_unlabeled_counter_latest_avg(
service['type'],
service['id'],
counter_path
counter_info['value'], counter_info['count'] = v, c
result[svc_full_name][counter_path] = counter_info
else:
- counter_info['value'] = self.get_latest(
+ counter_info['value'] = self.get_unlabeled_counter_latest(
service['type'],
service['id'],
counter_path
== {"testkey"} | existing_keys)
def _self_test_perf_counters(self) -> None:
- self.get_perf_schema("osd", "0")
- self.get_counter("osd", "0", "osd.op")
+ self.get_unlabeled_perf_schema("osd", "0")
+ self.get_unlabeled_counter("osd", "0", "osd.op")
# get_counter
# get_all_perf_coutners
class Module(MgrModule):
- def get_latest(self, daemon_type: str, daemon_name: str, stat: str) -> int:
- data = self.get_counter(daemon_type, daemon_name, stat)[stat]
+ def get_unlabeled_counter_latest(self, daemon_type: str, daemon_name: str, stat: str) -> int:
+ data = self.get_unlabeled_counter(daemon_type, daemon_name, stat)[stat]
if data:
return data[-1][1]
else:
return 0
def get_rate(self, daemon_type: str, daemon_name: str, stat: str) -> int:
- data = self.get_counter(daemon_type, daemon_name, stat)[stat]
+ data = self.get_unlabeled_counter(daemon_type, daemon_name, stat)[stat]
if data and len(data) > 1 and (int(data[-1][0] - data[-2][0]) != 0):
return (data[-1][1] - data[-2][1]) // int(data[-1][0] - data[-2][0])
else:
if up:
gid = mdsmap['up']["mds_{0}".format(rank)]
info = mdsmap['info']['gid_{0}'.format(gid)]
- dns = self.get_latest("mds", info['name'], "mds_mem.dn")
- inos = self.get_latest("mds", info['name'], "mds_mem.ino")
- dirs = self.get_latest("mds", info['name'], "mds_mem.dir")
- caps = self.get_latest("mds", info['name'], "mds_mem.cap")
+ dns = self.get_unlabeled_counter_latest("mds", info['name'], "mds_mem.dn")
+ inos = self.get_unlabeled_counter_latest("mds", info['name'], "mds_mem.ino")
+ dirs = self.get_unlabeled_counter_latest("mds", info['name'], "mds_mem.dir")
+ caps = self.get_unlabeled_counter_latest("mds", info['name'], "mds_mem.cap")
if rank == 0:
- client_count = self.get_latest("mds", info['name'],
+ client_count = self.get_unlabeled_counter_latest("mds", info['name'],
"mds_sessions.session_count")
elif client_count == 0:
# In case rank 0 was down, look at another rank's
# sessionmap to get an indication of clients.
- client_count = self.get_latest("mds", info['name'],
+ client_count = self.get_unlabeled_counter_latest("mds", info['name'],
"mds_sessions.session_count")
laggy = "laggy_since" in info
if daemon_info['state'] != "up:standby-replay":
continue
- inos = self.get_latest("mds", daemon_info['name'], "mds_mem.ino")
- dns = self.get_latest("mds", daemon_info['name'], "mds_mem.dn")
- dirs = self.get_latest("mds", daemon_info['name'], "mds_mem.dir")
- caps = self.get_latest("mds", daemon_info['name'], "mds_mem.cap")
+ inos = self.get_unlabeled_counter_latest("mds", daemon_info['name'], "mds_mem.ino")
+ dns = self.get_unlabeled_counter_latest("mds", daemon_info['name'], "mds_mem.dn")
+ dirs = self.get_unlabeled_counter_latest("mds", daemon_info['name'], "mds_mem.dir")
+ caps = self.get_unlabeled_counter_latest("mds", daemon_info['name'], "mds_mem.cap")
events = self.get_rate("mds", daemon_info['name'], "mds_log.replayed")
if output_format not in ('json', 'json-pretty'):
res[anon_host][anon_devid] = m
return res
- def get_latest(self, daemon_type: str, daemon_name: str, stat: str) -> int:
- data = self.get_counter(daemon_type, daemon_name, stat)[stat]
+ def get_unlabeled_counter_latest(self, daemon_type: str, daemon_name: str, stat: str) -> int:
+ data = self.get_unlabeled_counter(daemon_type, daemon_name, stat)[stat]
if data:
return data[-1][1]
else:
rbytes = 0
rsnaps = 0
for gid, mds in fs['info'].items():
- num_sessions += self.get_latest('mds', mds['name'],
+ num_sessions += self.get_unlabeled_counter_latest('mds', mds['name'],
'mds_sessions.session_count')
- cached_ino += self.get_latest('mds', mds['name'],
+ cached_ino += self.get_unlabeled_counter_latest('mds', mds['name'],
'mds_mem.ino')
- cached_dn += self.get_latest('mds', mds['name'],
+ cached_dn += self.get_unlabeled_counter_latest('mds', mds['name'],
'mds_mem.dn')
- cached_cap += self.get_latest('mds', mds['name'],
+ cached_cap += self.get_unlabeled_counter_latest('mds', mds['name'],
'mds_mem.cap')
- subtrees += self.get_latest('mds', mds['name'],
+ subtrees += self.get_unlabeled_counter_latest('mds', mds['name'],
'mds.subtrees')
if mds['rank'] == 0:
- rfiles = self.get_latest('mds', mds['name'],
+ rfiles = self.get_unlabeled_counter_latest('mds', mds['name'],
'mds.root_rfiles')
- rbytes = self.get_latest('mds', mds['name'],
+ rbytes = self.get_unlabeled_counter_latest('mds', mds['name'],
'mds.root_rbytes')
- rsnaps = self.get_latest('mds', mds['name'],
+ rsnaps = self.get_unlabeled_counter_latest('mds', mds['name'],
'mds.root_rsnaps')
report['fs']['filesystems'].append({ # type: ignore
'max_mds': fs['max_mds'],