]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: rename APIs for fetching perf schema and perf counter values to indicate that...
authorNaveen Naidu <naveennaidu479@gmail.com>
Wed, 19 Mar 2025 13:40:32 +0000 (19:10 +0530)
committerNaveen Naidu <naveennaidu479@gmail.com>
Tue, 8 Apr 2025 02:19:04 +0000 (07:49 +0530)
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 <naveen.naidu@ibm.com>
17 files changed:
doc/mgr/modules.rst
src/mgr/ActivePyModules.cc
src/mgr/ActivePyModules.h
src/mgr/BaseMgrModule.cc
src/pybind/mgr/ceph_module.pyi
src/pybind/mgr/dashboard/controllers/cephfs.py
src/pybind/mgr/dashboard/controllers/monitor.py
src/pybind/mgr/dashboard/controllers/osd.py
src/pybind/mgr/dashboard/services/ceph_service.py
src/pybind/mgr/dashboard/services/tcmu_service.py
src/pybind/mgr/dashboard/tests/test_osd.py
src/pybind/mgr/influx/module.py
src/pybind/mgr/insights/module.py
src/pybind/mgr/mgr_module.py
src/pybind/mgr/selftest/module.py
src/pybind/mgr/status/module.py
src/pybind/mgr/telemetry/module.py

index 667664139739fef67e3a0eb44567039dd40f0af9..b94eeaf70981835bb4978b6d344c4b4ae07fd017 100644 (file)
@@ -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
 
index 709fcfae227c751f423a6f1cdebb4ee747eeaad1..5a0fa1c817aa6aa9d196e6efdc5ec1357c8549cf 100644 (file)
@@ -839,7 +839,7 @@ void ActivePyModules::_refresh_config_map()
   }
 }
 
-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,
@@ -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)
 {
index a41540503756492de089528130babef11462e25e..cb2587b1be826fdaf75447ccde2e9798e765f5af 100644 (file)
@@ -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::function<void(
         PerfCounterInstance& counter_instance,
         PerfCounterType& counter_type,
index 8ec4fc51989ebf6991051f020b5c5eb6e50cb332..99c9abba8c917c8a30886598ebb7c13684a1b111 100644 (file)
@@ -640,44 +640,44 @@ ceph_get_context(BaseMgrModule *self)
 }
 
 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*
@@ -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"},
index 32c9a244148001db9a1e00e5c600ffb9d8968ce0..17969de19e6c313c1707f2e918fd811e6a346261 100644 (file)
@@ -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): ...
index 90e2f448b431290809958f6e0462f01279521670..29292329aafda14c04fa81bab7397c8e14ca36e3 100644 (file)
@@ -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
 
index 288b6977acea5dbc9a4cd4512ebdb4a850b49d1c..57e31d5efa459d5afb4657aa41ac9395d1548a88 100644 (file)
@@ -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:
index 07d8db7755b8a0daf13a77350778314c649c4572..c7a61810865308cf17f46021c4eca4ab05d89142 100644 (file)
@@ -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
index b393cce4e75d9f345b042f8e4347a3d68f21da73..c7a070e5d48e2d03e36720e54e08b4082b9397e7 100644 (file)
@@ -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
index a81b6e8f2224570e2e88ba2b84805e8e6078046e..b4abaa6b9637ef33d96a9510316e7a9840360e83 100644 (file)
@@ -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:
index 9b6dbd10de18d4f0c9364d41b407e2199df660ad..bc416847dd518213f9258f0db4c517431ccc4aa0 100644 (file)
@@ -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
 
index 6818783b341a8bc7d8533dc9f6ca662ce1365b54..2d8c5c174b0158828b3417696eb348a38af499db 100644 (file)
@@ -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]
 
index 5e891069e8f34def59174fe337ae2955e6ed1734..4f1ad4ad6ca011d60066112c01f422a5f7388e09 100644 (file)
@@ -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
index 752c792486739d66abae1cf197d949ba86794165..ca32bbf3bfe2d3d8c0195e1a6213d680fd07d574 100644 (file)
@@ -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
index 90b00628feb10c97bd32adc86bcab4113af24315..2115c1da35e99abb1cf2a2e8a51a8add44914a22 100644 (file)
@@ -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
 
index 2b59132c1cbafd3bad926c59d9974b84d2611445..d0026fd1ae299175aacc4343f9266ea1b38db321 100644 (file)
@@ -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'):
index ce05b1353b41b8850a6fece03ae8927eac603b2d..cd13dd79643191a3153784300c1ed5ce0fbbde9a 100644 (file)
@@ -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'],