diff --git a/dbms/src/Common/TiFlashMetrics.h b/dbms/src/Common/TiFlashMetrics.h index 8c87591328a..964f2f9fd11 100644 --- a/dbms/src/Common/TiFlashMetrics.h +++ b/dbms/src/Common/TiFlashMetrics.h @@ -180,6 +180,8 @@ namespace DB F(type_max_threads_of_raw, {"type", "total_max"}), \ F(type_total_threads_of_raw, {"type", "total"}), \ F(type_threads_of_client_cq_pool, {"type", "rpc_client_cq_pool"}), \ + F(type_threads_of_receiver_read_loop, {"type", "rpc_receiver_read_loop"}), \ + F(type_threads_of_receiver_reactor, {"type", "rpc_receiver_reactor"}), \ F(type_max_threads_of_establish_mpp, {"type", "rpc_establish_mpp_max"}), \ F(type_active_threads_of_establish_mpp, {"type", "rpc_establish_mpp"}), \ F(type_max_threads_of_dispatch_mpp, {"type", "rpc_dispatch_mpp_max"}), \ diff --git a/dbms/src/Flash/Mpp/ExchangeReceiver.cpp b/dbms/src/Flash/Mpp/ExchangeReceiver.cpp index 8f5b2819402..b7873fd5e62 100644 --- a/dbms/src/Flash/Mpp/ExchangeReceiver.cpp +++ b/dbms/src/Flash/Mpp/ExchangeReceiver.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -350,6 +351,12 @@ template void ExchangeReceiverBase::reactor(const std::vector & async_requests) { using AsyncHandler = AsyncRequestHandler; + + GET_METRIC(tiflash_thread_count, type_threads_of_receiver_reactor).Increment(); + SCOPE_EXIT({ + GET_METRIC(tiflash_thread_count, type_threads_of_receiver_reactor).Decrement(); + }); + CPUAffinityManager::getInstance().bindSelfQueryThread(); size_t alive_async_connections = async_requests.size(); @@ -406,6 +413,11 @@ void ExchangeReceiverBase::reactor(const std::vector & asyn template void ExchangeReceiverBase::readLoop(const Request & req) { + GET_METRIC(tiflash_thread_count, type_threads_of_receiver_read_loop).Increment(); + SCOPE_EXIT({ + GET_METRIC(tiflash_thread_count, type_threads_of_receiver_read_loop).Decrement(); + }); + CPUAffinityManager::getInstance().bindSelfQueryThread(); bool meet_error = false; String local_err_msg;