diff --git a/dbms/src/Common/TiFlashMetrics.h b/dbms/src/Common/TiFlashMetrics.h index cdecfc84bb5..1c578a5a119 100644 --- a/dbms/src/Common/TiFlashMetrics.h +++ b/dbms/src/Common/TiFlashMetrics.h @@ -840,11 +840,14 @@ static_assert(RAFT_REGION_BIG_WRITE_THRES * 4 < RAFT_REGION_BIG_WRITE_MAX, "Inva F(type_gac_req_acquire_tokens, {"type", "gac_req_acquire_tokens"}), \ F(type_gac_req_ru_consumption_delta, {"type", "gac_req_ru_consumption_delta"}), \ F(type_gac_resp_tokens, {"type", "gac_resp_tokens"}), \ - F(type_gac_resp_capacity, {"type", "gac_resp_capacity"}), \ - F(type_handling_mpp_task_dispatch, {"type", "handling_mpp_task_dispatch"}), \ - F(type_handling_mpp_task_establish, {"type", "handling_mpp_task_establish"}), \ - F(type_handling_mpp_task_cancel, {"type", "handling_mpp_task_cancel"}), \ - F(type_handling_mpp_task_run, {"type", "handling_mpp_task_run"})) \ + F(type_gac_resp_capacity, {"type", "gac_resp_capacity"})) \ + M(tiflash_request_count_per_resource_group, \ + "mpp request count for each resource group", \ + Counter, \ + F(type_mpp_task_dispatch, {"type", "mpp_task_dispatch"}), \ + F(type_mpp_task_establish, {"type", "mpp_task_establish"}), \ + F(type_mpp_task_cancel, {"type", "mpp_task_cancel"}), \ + F(type_mpp_task_run, {"type", "mpp_task_run"})) \ M(tiflash_compute_request_unit, \ "Request Unit used by tiflash compute for each resource group", \ Counter, \ diff --git a/dbms/src/Flash/EstablishCall.cpp b/dbms/src/Flash/EstablishCall.cpp index 8b4b00972de..99e8959a0d9 100644 --- a/dbms/src/Flash/EstablishCall.cpp +++ b/dbms/src/Flash/EstablishCall.cpp @@ -65,8 +65,6 @@ EstablishCallData::~EstablishCallData() if (stopwatch) { GET_METRIC(tiflash_coprocessor_handling_request_count, type_mpp_establish_conn).Decrement(); - GET_RESOURCE_GROUP_METRIC(tiflash_resource_group, type_handling_mpp_task_establish, resource_group_name) - .Decrement(); GET_METRIC(tiflash_coprocessor_request_duration_seconds, type_mpp_establish_conn) .Observe(stopwatch->elapsedSeconds()); } diff --git a/dbms/src/Flash/FlashService.cpp b/dbms/src/Flash/FlashService.cpp index 30e7bea9fa0..e3b2c67e34b 100644 --- a/dbms/src/Flash/FlashService.cpp +++ b/dbms/src/Flash/FlashService.cpp @@ -514,7 +514,8 @@ grpc::Status FlashService::DispatchMPPTask( GET_METRIC(tiflash_coprocessor_request_count, type_dispatch_mpp_task).Increment(); GET_METRIC(tiflash_coprocessor_handling_request_count, type_dispatch_mpp_task).Increment(); - GET_RESOURCE_GROUP_METRIC(tiflash_resource_group, type_handling_mpp_task_dispatch, resource_group).Increment(); + GET_RESOURCE_GROUP_METRIC(tiflash_request_count_per_resource_group, type_mpp_task_dispatch, resource_group) + .Increment(); GET_METRIC(tiflash_thread_count, type_active_threads_of_dispatch_mpp).Increment(); GET_METRIC(tiflash_thread_count, type_total_threads_of_raw).Increment(); if (!tryToResetMaxThreadsMetrics()) @@ -534,7 +535,6 @@ grpc::Status FlashService::DispatchMPPTask( GET_METRIC(tiflash_thread_count, type_total_threads_of_raw).Decrement(); GET_METRIC(tiflash_thread_count, type_active_threads_of_dispatch_mpp).Decrement(); GET_METRIC(tiflash_coprocessor_handling_request_count, type_dispatch_mpp_task).Decrement(); - GET_RESOURCE_GROUP_METRIC(tiflash_resource_group, type_handling_mpp_task_dispatch, resource_group).Decrement(); GET_METRIC(tiflash_coprocessor_request_duration_seconds, type_dispatch_mpp_task) .Observe(watch.elapsedSeconds()); GET_METRIC(tiflash_coprocessor_response_bytes, type_dispatch_mpp_task).Increment(response->ByteSizeLong()); @@ -613,8 +613,8 @@ grpc::Status AsyncFlashService::establishMPPConnectionAsync(EstablishCallData * GET_METRIC(tiflash_coprocessor_request_count, type_mpp_establish_conn).Increment(); GET_METRIC(tiflash_coprocessor_handling_request_count, type_mpp_establish_conn).Increment(); GET_RESOURCE_GROUP_METRIC( - tiflash_resource_group, - type_handling_mpp_task_establish, + tiflash_request_count_per_resource_group, + type_mpp_task_establish, call_data->getResourceGroupName()) .Increment(); @@ -659,7 +659,8 @@ grpc::Status FlashService::EstablishMPPConnection( GET_METRIC(tiflash_coprocessor_request_count, type_mpp_establish_conn).Increment(); GET_METRIC(tiflash_coprocessor_handling_request_count, type_mpp_establish_conn).Increment(); - GET_RESOURCE_GROUP_METRIC(tiflash_resource_group, type_handling_mpp_task_establish, resource_group).Increment(); + GET_RESOURCE_GROUP_METRIC(tiflash_request_count_per_resource_group, type_mpp_task_establish, resource_group) + .Increment(); GET_METRIC(tiflash_thread_count, type_active_threads_of_establish_mpp).Increment(); GET_METRIC(tiflash_thread_count, type_total_threads_of_raw).Increment(); if (!tryToResetMaxThreadsMetrics()) @@ -678,7 +679,6 @@ grpc::Status FlashService::EstablishMPPConnection( GET_METRIC(tiflash_thread_count, type_total_threads_of_raw).Decrement(); GET_METRIC(tiflash_thread_count, type_active_threads_of_establish_mpp).Decrement(); GET_METRIC(tiflash_coprocessor_handling_request_count, type_mpp_establish_conn).Decrement(); - GET_RESOURCE_GROUP_METRIC(tiflash_resource_group, type_handling_mpp_task_establish, resource_group).Decrement(); GET_METRIC(tiflash_coprocessor_request_duration_seconds, type_mpp_establish_conn) .Observe(watch.elapsedSeconds()); // TODO: update the value of metric tiflash_coprocessor_response_bytes. @@ -736,11 +736,11 @@ grpc::Status FlashService::CancelMPPTask( const auto & resource_group = request->meta().resource_group_name(); GET_METRIC(tiflash_coprocessor_request_count, type_cancel_mpp_task).Increment(); GET_METRIC(tiflash_coprocessor_handling_request_count, type_cancel_mpp_task).Increment(); - GET_RESOURCE_GROUP_METRIC(tiflash_resource_group, type_handling_mpp_task_cancel, resource_group).Increment(); + GET_RESOURCE_GROUP_METRIC(tiflash_request_count_per_resource_group, type_mpp_task_cancel, resource_group) + .Increment(); Stopwatch watch; SCOPE_EXIT({ GET_METRIC(tiflash_coprocessor_handling_request_count, type_cancel_mpp_task).Decrement(); - GET_RESOURCE_GROUP_METRIC(tiflash_resource_group, type_handling_mpp_task_cancel, resource_group).Decrement(); GET_METRIC(tiflash_coprocessor_request_duration_seconds, type_cancel_mpp_task).Observe(watch.elapsedSeconds()); GET_METRIC(tiflash_coprocessor_response_bytes, type_cancel_mpp_task).Increment(response->ByteSizeLong()); }); diff --git a/dbms/src/Flash/Mpp/MPPTask.cpp b/dbms/src/Flash/Mpp/MPPTask.cpp index 8b9ca1dd879..f6d8aef55ba 100644 --- a/dbms/src/Flash/Mpp/MPPTask.cpp +++ b/dbms/src/Flash/Mpp/MPPTask.cpp @@ -513,11 +513,10 @@ void MPPTask::runImpl() const auto & resource_group = dag_context->getResourceGroupName(); GET_METRIC(tiflash_coprocessor_request_count, type_run_mpp_task).Increment(); GET_METRIC(tiflash_coprocessor_handling_request_count, type_run_mpp_task).Increment(); - GET_RESOURCE_GROUP_METRIC(tiflash_resource_group, type_handling_mpp_task_run, resource_group).Increment(); + GET_RESOURCE_GROUP_METRIC(tiflash_request_count_per_resource_group, type_mpp_task_run, resource_group).Increment(); SCOPE_EXIT({ GET_METRIC(tiflash_coprocessor_handling_request_count, type_run_mpp_task).Decrement(); GET_METRIC(tiflash_coprocessor_request_duration_seconds, type_run_mpp_task).Observe(stopwatch.elapsedSeconds()); - GET_RESOURCE_GROUP_METRIC(tiflash_resource_group, type_handling_mpp_task_run, resource_group).Decrement(); }); // set cancellation hook