#include "DaemonState.h"
+#include "MgrSession.h"
+
#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_mgr
#undef dout_prefix
<< types.size() << " types, got "
<< report->packed.length() << " bytes of data" << dendl;
+ // Retrieve session state
+ MgrSessionRef session(static_cast<MgrSession*>(
+ report->get_connection()->get_priv()));
+
// Load any newly declared types
for (const auto &t : report->declare_types) {
types.insert(std::make_pair(t.path, t));
- declared_types.insert(t.path);
+ session->declared_types.insert(t.path);
}
// Remove any old types
for (const auto &t : report->undeclare_types) {
- declared_types.erase(t);
+ session->declared_types.erase(t);
}
const auto now = ceph_clock_now();
// Parse packed data according to declared set of types
bufferlist::iterator p = report->packed.begin();
DECODE_START(1, p);
- for (const auto &t_path : declared_types) {
+ for (const auto &t_path : session->declared_types) {
const auto &t = types.at(t_path);
uint64_t val = 0;
uint64_t avgcount = 0;
std::map<std::string, PerfCounterInstance> instances;
- // FIXME: this state is really local to DaemonServer, it's part
- // of the protocol rather than being part of what other classes
- // mgiht want to read. Maybe have a separate session object
- // inside DaemonServer instead of stashing session-ish state here?
- std::set<std::string> declared_types;
-
void update(MMgrReport *report);
void clear()
{
instances.clear();
- declared_types.clear();
}
};
// mon caps are suitably generic for mgr
MonCap caps;
+ std::set<std::string> declared_types;
+
MgrSession(CephContext *cct) : RefCountedObject(cct, 0) {}
~MgrSession() override {}
};
f.open_object_section(daemon_name.str().c_str());
Mutex::Locker l(state->lock);
- for (auto typestr : state->perf_counters.declared_types) {
+ for (const auto &ctr_inst_iter : state->perf_counters.instances) {
+ const auto &typestr = ctr_inst_iter.first;
+
f.open_object_section(typestr.c_str());
auto type = state->perf_counters.types[typestr];
f.dump_string("description", type.description);