diff --git a/core/parachain/approval/approval_distribution.cpp b/core/parachain/approval/approval_distribution.cpp index 63adc2225b..1f20a68140 100644 --- a/core/parachain/approval/approval_distribution.cpp +++ b/core/parachain/approval/approval_distribution.cpp @@ -554,6 +554,8 @@ namespace { } // namespace namespace kagome::parachain { + constexpr auto kMetricNoShowsTotal = + "kagome_parachain_approvals_no_shows_total"; ApprovalDistribution::ApprovalDistribution( std::shared_ptr babe_config_repo, @@ -598,7 +600,8 @@ namespace kagome::parachain { scheduler_{std::make_shared( std::make_shared( 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_); @@ -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() { @@ -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); } diff --git a/core/parachain/approval/approval_distribution.hpp b/core/parachain/approval/approval_distribution.hpp index 0b128a02de..281e6548d0 100644 --- a/core/parachain/approval/approval_distribution.hpp +++ b/core/parachain/approval/approval_distribution.hpp @@ -898,6 +898,9 @@ namespace kagome::parachain { }; SafeObject, std::mutex> approvals_cache_; + + metrics::RegistryPtr metrics_registry_; + metrics::Counter *metric_no_shows_total_; }; } // namespace kagome::parachain