Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kagome_parachain_approvals_no_shows_total #2168

Merged
merged 4 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion core/parachain/approval/approval_distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ namespace {
} // namespace

namespace kagome::parachain {
constexpr auto kMetricNoShowsTotal =
"kagome_parachain_approvals_no_shows_total";

ApprovalDistribution::ApprovalDistribution(
std::shared_ptr<consensus::babe::BabeConfigRepository> babe_config_repo,
Expand Down Expand Up @@ -598,7 +600,8 @@ namespace kagome::parachain {
scheduler_{std::make_shared<libp2p::basic::SchedulerImpl>(
std::make_shared<libp2p::basic::AsioSchedulerBackend>(
approval_thread_pool.io_context()),
libp2p::basic::Scheduler::Config{})} {
libp2p::basic::Scheduler::Config{})},
metrics_registry_{metrics::createRegistry()} {
BOOST_ASSERT(parachain_host_);
BOOST_ASSERT(keystore_);
BOOST_ASSERT(peer_view_);
Expand All @@ -614,6 +617,12 @@ namespace kagome::parachain {
BOOST_ASSERT(main_pool_handler_);
BOOST_ASSERT(worker_pool_handler_);
BOOST_ASSERT(approval_thread_handler_);

metrics_registry_->registerCounterFamily(
kMetricNoShowsTotal,
"Number of assignments which became no-shows in the approval voting subsystem");
metric_no_shows_total_ =
metrics_registry_->registerCounterMetric(kMetricNoShowsTotal);
}

bool ApprovalDistribution::tryStart() {
Expand Down Expand Up @@ -2996,6 +3005,11 @@ namespace kagome::parachain {
block_entry.mark_approved_by_hash(candidate_hash);
const auto is_block_approved = block_entry.is_fully_approved();

auto no_shows = known_no_shows(check);
if (no_shows != 0) {
metric_no_shows_total_->inc(no_shows);
}

if (is_block_approved && !was_block_approved) {
notifyApproved(block_hash);
}
Expand Down
3 changes: 3 additions & 0 deletions core/parachain/approval/approval_distribution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,9 @@ namespace kagome::parachain {
};
SafeObject<std::unordered_map<CandidateHash, ApprovalCache>, std::mutex>
approvals_cache_;

metrics::RegistryPtr metrics_registry_;
metrics::Counter *metric_no_shows_total_;
};

} // namespace kagome::parachain
Loading