Skip to content

Commit

Permalink
crimson/osd: update the osd stats with hb peers
Browse files Browse the repository at this point in the history
just to align with classic OSD

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Jul 3, 2020
1 parent 5bbbbc6 commit 0816f16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/crimson/osd/heartbeat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ void Heartbeat::update_peers(int whoami)
}
}

Heartbeat::osds_t Heartbeat::get_peers() const
{
osds_t osds;
osds.reserve(peers.size());
for (auto& peer : peers) {
osds.push_back(peer.first);
}
return osds;
}

void Heartbeat::remove_peer(osd_id_t peer)
{
auto found = peers.find(peer);
Expand Down
3 changes: 2 additions & 1 deletion src/crimson/osd/heartbeat.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ class Heartbeat : public crimson::net::Dispatcher {
entity_addrvec_t back);
seastar::future<> stop();

using osds_t = std::vector<osd_id_t>;
void add_peer(osd_id_t peer, epoch_t epoch);
void update_peers(int whoami);
void remove_peer(osd_id_t peer);
osds_t get_peers() const;

const entity_addrvec_t& get_front_addrs() const;
const entity_addrvec_t& get_back_addrs() const;
Expand All @@ -62,7 +64,6 @@ class Heartbeat : public crimson::net::Dispatcher {
Ref<MOSDPing> m);
seastar::future<> handle_you_died();

using osds_t = std::vector<osd_id_t>;
/// remove down OSDs
/// @return peers not needed in this epoch
osds_t remove_down_peers();
Expand Down
1 change: 1 addition & 0 deletions src/crimson/osd/osd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ void OSD::update_stats()
{
osd_stat_seq++;
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;
}

Expand Down

0 comments on commit 0816f16

Please sign in to comment.