crimson/osd: report statfs data

Signed-off-by: Xuehan Xu <xxhdx1985126@gmail.com>
This commit is contained in:
Xuehan Xu 2020-11-01 11:30:38 +08:00
parent 471531e25d
commit 124aa74deb
4 changed files with 10 additions and 4 deletions

View File

@ -148,7 +148,6 @@ seastar::future<> Client::handle_mgr_conf(crimson::net::Connection* conn,
void Client::report()
{
with_stats.update_stats();
gate.dispatch_in_background(__func__, *this, [this] {
assert(conn);
auto pg_stats = with_stats.get_stats();

View File

@ -24,7 +24,6 @@ namespace crimson::mgr
// implement WithStats if you want to report stats to mgr periodically
class WithStats {
public:
virtual void update_stats() = 0;
virtual MessageRef get_stats() const = 0;
virtual ~WithStats() {}
};

View File

@ -89,7 +89,10 @@ OSD::OSD(int id, uint32_t nonce,
shard_services{*this, whoami, *cluster_msgr, *public_msgr, *monc, *mgrc, *store},
heartbeat{new Heartbeat{whoami, shard_services, *monc, hb_front_msgr, hb_back_msgr}},
// do this in background
tick_timer{[this] { update_heartbeat_peers(); }},
tick_timer{[this] {
update_heartbeat_peers();
update_stats();
}},
asok{seastar::make_lw_shared<crimson::admin::AdminSocket>()},
osdmap_gate("OSD::osdmap_gate", std::make_optional(std::ref(shard_services)))
{
@ -721,6 +724,11 @@ void OSD::update_stats()
osd_stat.up_from = get_up_epoch();
osd_stat.hb_peers = heartbeat->get_peers();
osd_stat.seq = (static_cast<uint64_t>(get_up_epoch()) << 32) | osd_stat_seq;
gate.dispatch_in_background("statfs", *this, [this] {
(void) store->stat().then([this](store_statfs_t&& st) {
osd_stat.statfs = st;
});
});
}
MessageRef OSD::get_stats() const

View File

@ -105,7 +105,7 @@ class OSD final : public crimson::net::Dispatcher,
// pg statistics including osd ones
osd_stat_t osd_stat;
uint32_t osd_stat_seq = 0;
void update_stats() final;
void update_stats();
MessageRef get_stats() const final;
// AuthHandler methods