]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: do not ignore labeled perf counters in MMgrReport
authorNaveen Naidu <naveennaidu479@gmail.com>
Wed, 19 Mar 2025 13:43:47 +0000 (19:13 +0530)
committerNaveen Naidu <naveennaidu479@gmail.com>
Tue, 8 Apr 2025 02:26:44 +0000 (07:56 +0530)
The labeled perf counters are now included in the MMgrReport sent from
MgrClients. The 'get_unlabeled_perf_schema_python' is also updated to
ignore labeled counters, since labels counters requires new
representation format not supported by the current logic.

Signed-off-by: Naveen Naidu <naveen.naidu@ibm.com>
src/mgr/ActivePyModules.cc
src/mgr/ActivePyModules.h
src/mgr/BaseMgrModule.cc
src/mgr/MgrClient.cc

index 5a0fa1c817aa6aa9d196e6efdc5ec1357c8549cf..33a82e53c4d9968d60670e3477cb3461b1348a14 100644 (file)
@@ -19,6 +19,7 @@
 #include <rocksdb/version.h>
 
 #include "common/errno.h"
+#include "common/perf_counters_key.h"
 #include "crush/CrushWrapper.h"
 #include "include/stringify.h"
 
@@ -964,8 +965,17 @@ PyObject* ActivePyModules::get_unlabeled_perf_schema_python(
         f.open_object_section(key.c_str());
         for (auto ctr_inst_iter : state->perf_counters.instances) {
           const auto &counter_name = ctr_inst_iter.first;
-          f.open_object_section(counter_name.c_str());
-          auto type = state->perf_counters.types[counter_name];
+
+         // Ignore labeled counters. The perf schema format below can not
+         // accomodate counters with labels. A new representation format is
+         // requried to do support this.
+         auto labels = ceph::perf_counters::key_labels(counter_name);
+         if (labels.begin() != labels.end()) {
+           continue;
+         }
+
+         f.open_object_section(counter_name.c_str());
+         auto type = state->perf_counters.types[counter_name];
           f.dump_string("description", type.description);
           if (!type.nick.empty()) {
             f.dump_string("nick", type.nick);
index cb2587b1be826fdaf75447ccde2e9798e765f5af..172fc85694c595d1510fc134291944390847bd1a 100644 (file)
@@ -96,21 +96,21 @@ public:
     const std::string &svc_id,
     const std::string &path);
   PyObject *get_latest_unlabeled_counter_python(
-    const std::string &svc_type,
-    const std::string &svc_id,
-    const std::string &path);
+      const std::string &svc_type,
+      const std::string &svc_id,
+      const std::string &path);
   PyObject *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_rocksdb_version();
   PyObject *get_context();
   PyObject *get_osdmap();
   /// @note @c fct is not allowed to acquire locks when holding GIL
   PyObject *with_unlabled_perf_counters(
       std::function<void(
-        PerfCounterInstance& counter_instance,
-        PerfCounterType& counter_type,
-        PyFormatter& f)> fct,
+         PerfCounterInstance &counter_instance,
+         PerfCounterType &counter_type,
+         PyFormatter &f)> fct,
       const std::string &svc_name,
       const std::string &svc_id,
       const std::string &path) const;
index 99c9abba8c917c8a30886598ebb7c13684a1b111..ebdd6f4c26860d9ce625432c12982afb149f04d5 100644 (file)
@@ -1485,7 +1485,7 @@ PyMethodDef BaseMgrModule_methods[] = {
     "Get a performance counter"},
 
   {"_ceph_get_latest_unlabeled_counter", (PyCFunction)get_latest_unlabeled_counter, METH_VARARGS,
-    "Get the latest performance counter"},
+    "Fetch (or get) the latest (or updated) value of an unlabeled counter"},
 
   {"_ceph_get_unlabeled_perf_schema", (PyCFunction)get_unlabeled_perf_schema, METH_VARARGS,
     "Get the unlabeled performance counter schema"},
index 01dbf2914eb4ddd5a0d8814a1e3c0eddaa19017d..23843622b386be4599e69942703e06bcde241c0a 100644 (file)
@@ -330,15 +330,8 @@ void MgrClient::_send_report()
   {
     // Helper for checking whether a counter should be included
     auto include_counter = [this](
-        const PerfCounters::perf_counter_data_any_d &ctr,
-        const PerfCounters &perf_counters)
-    {
-      // FIXME: We don't send labeled perf counters to the mgr currently.
-      auto labels = ceph::perf_counters::key_labels(perf_counters.get_name());
-      if (labels.begin() != labels.end()) {
-        return false;
-      }
-
+                              const PerfCounters::perf_counter_data_any_d &ctr,
+                              const PerfCounters &perf_counters) {
       return perf_counters.get_adjusted_priority(ctr.prio) >= (int)stats_threshold;
     };