};
template std::unique_ptr<AdminSocketHook> make_asok_hook<ConfigSetHook>();
+/**
+ * send the latest pg stats to mgr
+ */
+class FlushPgStatsHook : public AdminSocketHook {
+public:
+ explicit FlushPgStatsHook(crimson::osd::OSD& osd) :
+ AdminSocketHook("flush_pg_stats",
+ "flush_pg_stats",
+ "flush pg stats"),
+ osd{osd}
+ {}
+ seastar::future<tell_result_t> call(const cmdmap_t&,
+ std::string_view format,
+ ceph::bufferlist&& input) const final
+ {
+ uint64_t seq = osd.send_pg_stats();
+ unique_ptr<Formatter> f{Formatter::create(format, "json-pretty", "json-pretty")};
+ f->dump_unsigned("stat_seq", seq);
+ return seastar::make_ready_future<tell_result_t>(tell_result_t(f.get()));
+ }
+
+private:
+ crimson::osd::OSD& osd;
+};
+template std::unique_ptr<AdminSocketHook> make_asok_hook<FlushPgStatsHook>(crimson::osd::OSD& osd);
+
/**
* A CephContext admin hook: calling assert (if allowed by
* 'debug_asok_assert_abort')
namespace crimson::admin {
-class OsdStatusHook;
-class SendBeaconHook;
+class AssertAlwaysHook;
class ConfigShowHook;
class ConfigGetHook;
class ConfigSetHook;
-class AssertAlwaysHook;
+class FlushPgStatsHook;
+class OsdStatusHook;
+class SendBeaconHook;
template<class Hook, class... Args>
std::unique_ptr<AdminSocketHook> make_asok_hook(Args&&... args);
WithStats& with_stats);
seastar::future<> start();
seastar::future<> stop();
+ void report();
+
private:
seastar::future<> ms_dispatch(crimson::net::Connection* conn,
Ref<Message> m) override;
seastar::future<> handle_mgr_conf(crimson::net::Connection* conn,
Ref<MMgrConfigure> m);
seastar::future<> reconnect();
- void report();
void print(std::ostream&) const;
friend std::ostream& operator<<(std::ostream& out, const Client& client);
asok->register_command(make_asok_hook<SendBeaconHook>(*this)),
asok->register_command(make_asok_hook<ConfigShowHook>()),
asok->register_command(make_asok_hook<ConfigGetHook>()),
- asok->register_command(make_asok_hook<ConfigSetHook>()));
+ asok->register_command(make_asok_hook<ConfigSetHook>()),
+ asok->register_command(make_asok_hook<FlushPgStatsHook>(*this)));
});
}
return m;
}
+uint64_t OSD::send_pg_stats()
+{
+ // mgr client sends the report message in background
+ mgrc->report();
+ return osd_stat_seq;
+}
+
OSD::cached_map_t OSD::get_map() const
{
return osdmap;
seastar::future<> send_incremental_map(crimson::net::Connection* conn,
epoch_t first);
+
+ /// @return the seq id of the pg stats being sent
+ uint64_t send_pg_stats();
+
private:
seastar::future<> start_boot();
seastar::future<> _preboot(version_t oldest_osdmap, version_t newest_osdmap);