]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/messages/MMgrReport.h
update sources to v12.2.3
[ceph.git] / ceph / src / messages / MMgrReport.h
index 9b033ec23c23645bf7bf474635a99fa6e93da662..f6af6dfb86aa06a0da4b0e1744fba0e1916ab6c1 100644 (file)
@@ -20,6 +20,7 @@
 #include "msg/Message.h"
 
 #include "common/perf_counters.h"
+#include "osd/OSDHealthMetric.h"
 
 class PerfCounterType
 {
@@ -29,27 +30,36 @@ public:
   std::string nick;
   enum perfcounter_type_d type;
 
+  // For older clients that did not send priority, pretend everything
+  // is "useful" so that mgr plugins filtering on prio will get some
+  // data (albeit probably more than they wanted)
+  uint8_t priority = PerfCountersBuilder::PRIO_USEFUL;
+
   void encode(bufferlist &bl) const
   {
     // TODO: decide whether to drop the per-type
     // encoding here, we could rely on the MgrReport
     // verisoning instead.
-    ENCODE_START(1, 1, bl);
+    ENCODE_START(2, 1, bl);
     ::encode(path, bl);
     ::encode(description, bl);
     ::encode(nick, bl);
     static_assert(sizeof(type) == 1, "perfcounter_type_d must be one byte");
     ::encode((uint8_t)type, bl);
+    ::encode(priority, bl);
     ENCODE_FINISH(bl);
   }
   
   void decode(bufferlist::iterator &p)
   {
-    DECODE_START(1, p);
+    DECODE_START(2, p);
     ::decode(path, p);
     ::decode(description, p);
     ::decode(nick, p);
     ::decode((uint8_t&)type, p);
+    if (struct_v >= 2) {
+      ::decode(priority, p);
+    }
     DECODE_FINISH(p);
   }
 };
@@ -57,7 +67,7 @@ WRITE_CLASS_ENCODER(PerfCounterType)
 
 class MMgrReport : public Message
 {
-  static const int HEAD_VERSION = 4;
+  static const int HEAD_VERSION = 5;
   static const int COMPAT_VERSION = 1;
 
 public:
@@ -83,6 +93,8 @@ public:
   // for service registration
   boost::optional<std::map<std::string,std::string>> daemon_status;
 
+  std::vector<OSDHealthMetric> osd_health_metrics;
+
   void decode_payload() override
   {
     bufferlist::iterator p = payload.begin();
@@ -95,6 +107,9 @@ public:
       ::decode(service_name, p);
       ::decode(daemon_status, p);
     }
+    if (header.version >= 5) {
+      ::decode(osd_health_metrics, p);
+    }
   }
 
   void encode_payload(uint64_t features) override {
@@ -104,6 +119,7 @@ public:
     ::encode(undeclare_types, payload);
     ::encode(service_name, payload);
     ::encode(daemon_status, payload);
+    ::encode(osd_health_metrics, payload);
   }
 
   const char *get_type_name() const override { return "mgrreport"; }
@@ -121,6 +137,9 @@ public:
     if (daemon_status) {
       out << " status=" << daemon_status->size();
     }
+    if (!osd_health_metrics.empty()) {
+      out << " osd_metrics=" << osd_health_metrics.size();
+    }
     out << ")";
   }