From d377262c7af83d21d0c1a5bd37551828179e0f93 Mon Sep 17 00:00:00 2001 From: turuslan Date: Fri, 2 Aug 2024 12:03:22 +0500 Subject: [PATCH 1/2] kagome_parachain_approvals_no_shows_total Signed-off-by: turuslan --- core/parachain/approval/approval_distribution.cpp | 13 +++++++++++++ core/parachain/approval/approval_distribution.hpp | 3 +++ 2 files changed, 16 insertions(+) diff --git a/core/parachain/approval/approval_distribution.cpp b/core/parachain/approval/approval_distribution.cpp index 9ed7b7f0b2..320da9074c 100644 --- a/core/parachain/approval/approval_distribution.cpp +++ b/core/parachain/approval/approval_distribution.cpp @@ -441,6 +441,8 @@ namespace { } // namespace namespace kagome::parachain { + constexpr auto kMetricNoShowsTotal = + "kagome_parachain_approvals_no_shows_total"; ApprovalDistribution::ApprovalDistribution( std::shared_ptr babe_config_repo, @@ -501,6 +503,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() { @@ -2522,6 +2530,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 6e4346c815..0581b29be9 100644 --- a/core/parachain/approval/approval_distribution.hpp +++ b/core/parachain/approval/approval_distribution.hpp @@ -729,6 +729,9 @@ namespace kagome::parachain { }; SafeObject, std::mutex> approvals_cache_; + + metrics::RegistryPtr metrics_registry_ = metrics::createRegistry(); + metrics::Counter *metric_no_shows_total_; }; } // namespace kagome::parachain From a705832503b133aaf485364cd7b0a2b40428fa9a Mon Sep 17 00:00:00 2001 From: turuslan Date: Fri, 2 Aug 2024 13:54:31 +0500 Subject: [PATCH 2/2] pr comment Signed-off-by: turuslan --- core/parachain/approval/approval_distribution.cpp | 3 ++- core/parachain/approval/approval_distribution.hpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/parachain/approval/approval_distribution.cpp b/core/parachain/approval/approval_distribution.cpp index 320da9074c..54b1d749bd 100644 --- a/core/parachain/approval/approval_distribution.cpp +++ b/core/parachain/approval/approval_distribution.cpp @@ -487,7 +487,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_); diff --git a/core/parachain/approval/approval_distribution.hpp b/core/parachain/approval/approval_distribution.hpp index 0581b29be9..7f0939641f 100644 --- a/core/parachain/approval/approval_distribution.hpp +++ b/core/parachain/approval/approval_distribution.hpp @@ -730,7 +730,7 @@ namespace kagome::parachain { SafeObject, std::mutex> approvals_cache_; - metrics::RegistryPtr metrics_registry_ = metrics::createRegistry(); + metrics::RegistryPtr metrics_registry_; metrics::Counter *metric_no_shows_total_; };