Skip to content

Commit

Permalink
add snapshot metric
Browse files Browse the repository at this point in the history
  • Loading branch information
critical27 committed Feb 10, 2022
1 parent c532203 commit 2c7ecfa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/kvstore/raftex/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ nebula::cpp2::ErrorCode Host::startSendSnapshot() {
<< ", firstLogId in wal = " << part_->wal()->firstLogId()
<< ", lastLogId in wal = " << part_->wal()->lastLogId();
sendingSnapshot_ = true;
stats::StatsManager::addValue(kNumSendSnapshot);
part_->snapshot_->sendSnapshot(part_, addr_)
.thenValue([self = shared_from_this()](auto&& status) {
std::lock_guard<std::mutex> g(self->lock_);
Expand Down
2 changes: 2 additions & 0 deletions src/kvstore/stats/KVStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ stats::CounterId kAppendLogLatencyUs;
stats::CounterId kTransferLeaderLatencyUs;
stats::CounterId kNumStartElect;
stats::CounterId kNumGrantVotes;
stats::CounterId kNumSendSnapshot;

void initKVStats() {
kCommitLogLatencyUs = stats::StatsManager::registerHisto(
Expand All @@ -34,6 +35,7 @@ void initKVStats() {
"transfer_leader_latency_us", 1000, 0, 2000, "avg, p75, p95, p99, p999");
kNumStartElect = stats::StatsManager::registerStats("num_start_elect", "rate, sum");
kNumGrantVotes = stats::StatsManager::registerStats("num_grant_votes", "rate, sum");
kNumSendSnapshot = stats::StatsManager::registerStats("num_send_snapshot", "rate, sum");
}

} // namespace nebula
1 change: 1 addition & 0 deletions src/kvstore/stats/KVStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extern stats::CounterId kAppendLogLatencyUs;
extern stats::CounterId kTransferLeaderLatencyUs;
extern stats::CounterId kNumStartElect;
extern stats::CounterId kNumGrantVotes;
extern stats::CounterId kNumSendSnapshot;

void initKVStats();

Expand Down

0 comments on commit 2c7ecfa

Please sign in to comment.