#include <boost/optional.hpp>
#include "msg/Message.h"
+#include "mgr/OSDPerfMetricTypes.h"
#include "common/perf_counters.h"
-#include "osd/OSDHealthMetric.h"
+#include "mgr/DaemonHealthMetric.h"
class PerfCounterType
{
// encoding here, we could rely on the MgrReport
// verisoning instead.
ENCODE_START(3, 1, bl);
- ::encode(path, bl);
- ::encode(description, bl);
- ::encode(nick, 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((uint8_t)unit, bl);
+ encode((uint8_t)type, bl);
+ encode(priority, bl);
+ encode((uint8_t)unit, bl);
ENCODE_FINISH(bl);
}
- void decode(bufferlist::iterator &p)
+ void decode(bufferlist::const_iterator &p)
{
DECODE_START(3, p);
- ::decode(path, p);
- ::decode(description, p);
- ::decode(nick, p);
- ::decode((uint8_t&)type, p);
+ decode(path, p);
+ decode(description, p);
+ decode(nick, p);
+ decode((uint8_t&)type, p);
if (struct_v >= 2) {
- ::decode(priority, p);
+ decode(priority, p);
}
if (struct_v >= 3) {
- ::decode((uint8_t&)unit, p);
+ decode((uint8_t&)unit, p);
}
DECODE_FINISH(p);
}
};
WRITE_CLASS_ENCODER(PerfCounterType)
-class MMgrReport : public Message
-{
- static const int HEAD_VERSION = 5;
- static const int COMPAT_VERSION = 1;
+class MMgrReport : public MessageInstance<MMgrReport> {
+public:
+ friend factory;
+private:
+
+ static constexpr int HEAD_VERSION = 7;
+ static constexpr int COMPAT_VERSION = 1;
public:
/**
// for service registration
boost::optional<std::map<std::string,std::string>> daemon_status;
- std::vector<OSDHealthMetric> osd_health_metrics;
+ std::vector<DaemonHealthMetric> daemon_health_metrics;
+
+ // encode map<string,map<int32_t,string>> of current config
+ bufferlist config_bl;
+
+ std::map<OSDPerfMetricQuery, OSDPerfMetricReport> osd_perf_metric_reports;
void decode_payload() override
{
- bufferlist::iterator p = payload.begin();
- ::decode(daemon_name, p);
- ::decode(declare_types, p);
- ::decode(packed, p);
+ auto p = payload.cbegin();
+ decode(daemon_name, p);
+ decode(declare_types, p);
+ decode(packed, p);
if (header.version >= 2)
- ::decode(undeclare_types, p);
+ decode(undeclare_types, p);
if (header.version >= 3) {
- ::decode(service_name, p);
- ::decode(daemon_status, p);
+ decode(service_name, p);
+ decode(daemon_status, p);
}
if (header.version >= 5) {
- ::decode(osd_health_metrics, p);
+ decode(daemon_health_metrics, p);
+ }
+ if (header.version >= 6) {
+ decode(config_bl, p);
+ }
+ if (header.version >= 7) {
+ decode(osd_perf_metric_reports, p);
}
}
void encode_payload(uint64_t features) override {
- ::encode(daemon_name, payload);
- ::encode(declare_types, payload);
- ::encode(packed, payload);
- ::encode(undeclare_types, payload);
- ::encode(service_name, payload);
- ::encode(daemon_status, payload);
- ::encode(osd_health_metrics, payload);
+ using ceph::encode;
+ encode(daemon_name, payload);
+ encode(declare_types, payload);
+ encode(packed, payload);
+ encode(undeclare_types, payload);
+ encode(service_name, payload);
+ encode(daemon_status, payload);
+ encode(daemon_health_metrics, payload);
+ encode(config_bl, payload);
+ encode(osd_perf_metric_reports, payload);
}
- const char *get_type_name() const override { return "mgrreport"; }
+ std::string_view get_type_name() const override { return "mgrreport"; }
void print(ostream& out) const override {
out << get_type_name() << "(";
if (service_name.length()) {
if (daemon_status) {
out << " status=" << daemon_status->size();
}
- if (!osd_health_metrics.empty()) {
- out << " osd_metrics=" << osd_health_metrics.size();
+ if (!daemon_health_metrics.empty()) {
+ out << " daemon_metrics=" << daemon_health_metrics.size();
}
out << ")";
}
MMgrReport()
- : Message(MSG_MGR_REPORT, HEAD_VERSION, COMPAT_VERSION)
+ : MessageInstance(MSG_MGR_REPORT, HEAD_VERSION, COMPAT_VERSION)
{}
};