]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/messages/MMgrReport.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / messages / MMgrReport.h
index dcfbf658546ab4bc095598b0171da1f472aa9605..c1a55d880cf6084a7174c3378296ae11f40a1570 100644 (file)
 #include <boost/optional.hpp>
 
 #include "msg/Message.h"
+#include "mgr/MetricTypes.h"
 #include "mgr/OSDPerfMetricTypes.h"
 
 #include "common/perf_counters.h"
+#include "include/common_fwd.h"
 #include "mgr/DaemonHealthMetric.h"
 
 class PerfCounterType
@@ -37,7 +39,7 @@ public:
   uint8_t priority = PerfCountersBuilder::PRIO_USEFUL;
   enum unit_t unit;
 
-  void encode(bufferlist &bl) const
+  void encode(ceph::buffer::list &bl) const
   {
     // TODO: decide whether to drop the per-type
     // encoding here, we could rely on the MgrReport
@@ -53,7 +55,7 @@ public:
     ENCODE_FINISH(bl);
   }
   
-  void decode(bufferlist::const_iterator &p)
+  void decode(ceph::buffer::list::const_iterator &p)
   {
     DECODE_START(3, p);
     decode(path, p);
@@ -71,12 +73,9 @@ public:
 };
 WRITE_CLASS_ENCODER(PerfCounterType)
 
-class MMgrReport : public MessageInstance<MMgrReport> {
-public:
-  friend factory;
+class MMgrReport : public Message {
 private:
-
-  static constexpr int HEAD_VERSION = 7;
+  static constexpr int HEAD_VERSION = 9;
   static constexpr int COMPAT_VERSION = 1;
 
 public:
@@ -93,24 +92,28 @@ public:
 
   // Decode: iterate over the types we know about, sorted by idx,
   // and use the current type's type to decide how to decode
-  // the next bytes from the bufferlist.
-  bufferlist packed;
+  // the next bytes from the ceph::buffer::list.
+  ceph::buffer::list packed;
 
   std::string daemon_name;
   std::string service_name;  // optional; otherwise infer from entity type
 
   // for service registration
   boost::optional<std::map<std::string,std::string>> daemon_status;
+  boost::optional<std::map<std::string,std::string>> task_status;
 
   std::vector<DaemonHealthMetric> daemon_health_metrics;
 
   // encode map<string,map<int32_t,string>> of current config
-  bufferlist config_bl;
+  ceph::buffer::list config_bl;
 
   std::map<OSDPerfMetricQuery, OSDPerfMetricReport>  osd_perf_metric_reports;
 
+  boost::optional<MetricReportMessage> metric_report_message;
+
   void decode_payload() override
   {
+    using ceph::decode;
     auto p = payload.cbegin();
     decode(daemon_name, p);
     decode(declare_types, p);
@@ -130,6 +133,12 @@ public:
     if (header.version >= 7) {
       decode(osd_perf_metric_reports, p);
     }
+    if (header.version >= 8) {
+      decode(task_status, p);
+    }
+    if (header.version >= 9) {
+      decode(metric_report_message, p);
+    }
   }
 
   void encode_payload(uint64_t features) override {
@@ -143,10 +152,12 @@ public:
     encode(daemon_health_metrics, payload);
     encode(config_bl, payload);
     encode(osd_perf_metric_reports, payload);
+    encode(task_status, payload);
+    encode(metric_report_message, payload);
   }
 
   std::string_view get_type_name() const override { return "mgrreport"; }
-  void print(ostream& out) const override {
+  void print(std::ostream& out) const override {
     out << get_type_name() << "(";
     if (service_name.length()) {
       out << service_name;
@@ -163,13 +174,20 @@ public:
     if (!daemon_health_metrics.empty()) {
       out << " daemon_metrics=" << daemon_health_metrics.size();
     }
+    if (task_status) {
+      out << " task_status=" << task_status->size();
+    }
     out << ")";
   }
 
+private:
   MMgrReport()
-    : MessageInstance(MSG_MGR_REPORT, HEAD_VERSION, COMPAT_VERSION)
+    : Message{MSG_MGR_REPORT, HEAD_VERSION, COMPAT_VERSION}
   {}
+  using RefCountedObject::put;
+  using RefCountedObject::get;
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
 };
 
 #endif
-