From: Naveen Naidu Date: Wed, 19 Mar 2025 13:40:32 +0000 (+0530) Subject: mgr: rename APIs for fetching perf schema and perf counter values to indicate that... X-Git-Tag: v20.3.0~45^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a81901e1a23de02d39bfb1b270b4f8d8a0f273aa;p=ceph.git mgr: rename APIs for fetching perf schema and perf counter values to indicate that they only work on unlabeled counters. The current API's for fetching performance schema only fetches unlabeled counters and the API for fetching the latest value of the performance counters also only works on unlabeled counters. We update the name of these API's to correctly reflect this behaviour. This change is also required to make sure that we do not break any existing functionality while we work on the support of gradually phasing all the manager clients such as telemetry to work with labeled counters. Signed-off-by: Naveen Naidu --- diff --git a/doc/mgr/modules.rst b/doc/mgr/modules.rst index 66766413973..b94eeaf7098 100644 --- a/doc/mgr/modules.rst +++ b/doc/mgr/modules.rst @@ -505,8 +505,9 @@ function. This will result in a circular locking exception. .. 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 diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index 709fcfae227..5a0fa1c817a 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -839,7 +839,7 @@ void ActivePyModules::_refresh_config_map() } } -PyObject* ActivePyModules::with_perf_counters( +PyObject* ActivePyModules::with_unlabled_perf_counters( std::function fct, const std::string &svc_name, const std::string &svc_id, @@ -876,7 +876,7 @@ PyObject* ActivePyModules::with_perf_counters( 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) @@ -905,10 +905,10 @@ PyObject* ActivePyModules::get_counter_python( } } }; - 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) @@ -929,10 +929,10 @@ PyObject* ActivePyModules::get_latest_counter_python( 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) { diff --git a/src/mgr/ActivePyModules.h b/src/mgr/ActivePyModules.h index a4154050375..cb2587b1be8 100644 --- a/src/mgr/ActivePyModules.h +++ b/src/mgr/ActivePyModules.h @@ -91,22 +91,22 @@ public: 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::functionpy_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* @@ -1481,14 +1481,14 @@ PyMethodDef BaseMgrModule_methods[] = { {"_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"}, diff --git a/src/pybind/mgr/ceph_module.pyi b/src/pybind/mgr/ceph_module.pyi index 32c9a244148..17969de19e6 100644 --- a/src/pybind/mgr/ceph_module.pyi +++ b/src/pybind/mgr/ceph_module.pyi @@ -72,9 +72,10 @@ class BaseMgrModule(object): 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): ... diff --git a/src/pybind/mgr/dashboard/controllers/cephfs.py b/src/pybind/mgr/dashboard/controllers/cephfs.py index 90e2f448b43..29292329aaf 100644 --- a/src/pybind/mgr/dashboard/controllers/cephfs.py +++ b/src/pybind/mgr/dashboard/controllers/cephfs.py @@ -193,7 +193,7 @@ class CephFS(RESTController): 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: @@ -246,10 +246,10 @@ class CephFS(RESTController): 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") @@ -302,16 +302,17 @@ class CephFS(RESTController): 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 diff --git a/src/pybind/mgr/dashboard/controllers/monitor.py b/src/pybind/mgr/dashboard/controllers/monitor.py index 288b6977ace..57e31d5efa4 100644 --- a/src/pybind/mgr/dashboard/controllers/monitor.py +++ b/src/pybind/mgr/dashboard/controllers/monitor.py @@ -116,7 +116,7 @@ class Monitor(BaseController): 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: diff --git a/src/pybind/mgr/dashboard/controllers/osd.py b/src/pybind/mgr/dashboard/controllers/osd.py index 07d8db7755b..c7a61810865 100644 --- a/src/pybind/mgr/dashboard/controllers/osd.py +++ b/src/pybind/mgr/dashboard/controllers/osd.py @@ -187,7 +187,9 @@ class Osd(RESTController): 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 diff --git a/src/pybind/mgr/dashboard/services/ceph_service.py b/src/pybind/mgr/dashboard/services/ceph_service.py index b393cce4e75..c7a070e5d48 100644 --- a/src/pybind/mgr/dashboard/services/ceph_service.py +++ b/src/pybind/mgr/dashboard/services/ceph_service.py @@ -94,7 +94,7 @@ class CephService(object): @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()): @@ -105,7 +105,7 @@ class CephService(object): 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) @@ -467,9 +467,9 @@ class CephService(object): @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 diff --git a/src/pybind/mgr/dashboard/services/tcmu_service.py b/src/pybind/mgr/dashboard/services/tcmu_service.py index a81b6e8f222..b4abaa6b963 100644 --- a/src/pybind/mgr/dashboard/services/tcmu_service.py +++ b/src/pybind/mgr/dashboard/services/tcmu_service.py @@ -61,9 +61,9 @@ class TcmuService(object): 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: diff --git a/src/pybind/mgr/dashboard/tests/test_osd.py b/src/pybind/mgr/dashboard/tests/test_osd.py index 9b6dbd10de1..bc416847dd5 100644 --- a/src/pybind/mgr/dashboard/tests/test_osd.py +++ b/src/pybind/mgr/dashboard/tests/test_osd.py @@ -242,8 +242,12 @@ class OsdTest(ControllerTestCase): 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 diff --git a/src/pybind/mgr/influx/module.py b/src/pybind/mgr/influx/module.py index 6818783b341..2d8c5c174b0 100644 --- a/src/pybind/mgr/influx/module.py +++ b/src/pybind/mgr/influx/module.py @@ -162,8 +162,8 @@ class Module(MgrModule): 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] diff --git a/src/pybind/mgr/insights/module.py b/src/pybind/mgr/insights/module.py index 5e891069e8f..4f1ad4ad6ca 100644 --- a/src/pybind/mgr/insights/module.py +++ b/src/pybind/mgr/insights/module.py @@ -225,7 +225,7 @@ class Module(MgrModule): 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 diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 752c7924867..ca32bbf3bfe 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -1628,10 +1628,9 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): 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 @@ -1641,7 +1640,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): :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: """ @@ -1652,10 +1651,9 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): 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. @@ -1668,14 +1666,12 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): 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. @@ -1688,7 +1684,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): (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]: @@ -2194,8 +2190,8 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): 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] @@ -2203,8 +2199,8 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): 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 @@ -2247,7 +2243,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): 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'] @@ -2275,7 +2271,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): 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 @@ -2283,7 +2279,7 @@ class MgrModule(ceph_module.BaseMgrModule, MgrModuleLoggingMixin): 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 diff --git a/src/pybind/mgr/selftest/module.py b/src/pybind/mgr/selftest/module.py index 90b00628feb..2115c1da35e 100644 --- a/src/pybind/mgr/selftest/module.py +++ b/src/pybind/mgr/selftest/module.py @@ -362,8 +362,8 @@ class Module(MgrModule): == {"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 diff --git a/src/pybind/mgr/status/module.py b/src/pybind/mgr/status/module.py index 2b59132c1cb..d0026fd1ae2 100644 --- a/src/pybind/mgr/status/module.py +++ b/src/pybind/mgr/status/module.py @@ -15,15 +15,15 @@ from mgr_module import CLIReadCommand, MgrModule, HandleCommandResult 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: @@ -69,18 +69,18 @@ class Module(MgrModule): 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 @@ -145,10 +145,10 @@ class Module(MgrModule): 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'): diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index ce05b1353b4..cd13dd79643 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -986,8 +986,8 @@ class Module(MgrModule): 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: @@ -1203,22 +1203,22 @@ class Module(MgrModule): 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'],