diff --git a/dbms/src/Common/TiFlashMetrics.h b/dbms/src/Common/TiFlashMetrics.h index 6f6dd1239c0..338d5ef004b 100644 --- a/dbms/src/Common/TiFlashMetrics.h +++ b/dbms/src/Common/TiFlashMetrics.h @@ -43,16 +43,16 @@ namespace DB /// 4. Keep it proper formatted using clang-format. // clang-format off #define APPLY_FOR_METRICS(M, F) \ - M(tiflash_coprocessor_request_count, "Total number of request", Counter, F(type_cop, {"type", "cop"}), F(type_cop_dag, {"type", "cop_dag"}), \ - F(type_super_batch, {"type", "super_batch"}), F(type_super_batch_cop_dag, {"type", "super_batch_cop_dag"}), \ + M(tiflash_coprocessor_request_count, "Total number of request", Counter, F(type_cop, {"type", "cop"}), F(type_cop_executing, {"type", "cop_executing"}), \ + F(type_batch, {"type", "batch"}), F(type_batch_executing, {"type", "batch_executing"}), \ F(type_dispatch_mpp_task, {"type", "dispatch_mpp_task"}), F(type_mpp_establish_conn, {"type", "mpp_establish_conn"}), \ F(type_cancel_mpp_task, {"type", "cancel_mpp_task"}), F(type_run_mpp_task, {"type", "run_mpp_task"}), \ F(type_remote_read, {"type", "remote_read"}), F(type_remote_read_sent, {"type", "remote_read_sent"})) \ - M(tiflash_coprocessor_handling_request_count, "Number of handling request", Gauge, F(type_cop, {"type", "cop"}), F(type_cop_dag, {"type", "cop_dag"}), \ - F(type_super_batch, {"type", "super_batch"}), F(type_super_batch_cop_dag, {"type", "super_batch_cop_dag"}), \ + M(tiflash_coprocessor_handling_request_count, "Number of handling request", Gauge, F(type_cop, {"type", "cop"}), F(type_cop_executing, {"type", "cop_executing"}), \ + F(type_batch, {"type", "batch"}), F(type_batch_executing, {"type", "batch_executing"}), \ F(type_dispatch_mpp_task, {"type", "dispatch_mpp_task"}), F(type_mpp_establish_conn, {"type", "mpp_establish_conn"}), \ F(type_cancel_mpp_task, {"type", "cancel_mpp_task"}), F(type_run_mpp_task, {"type", "run_mpp_task"}), \ - F(type_remote_read, {"type", "remote_read"}), F(type_remote_read_dag, {"type", "remote_read_dag"})) \ + F(type_remote_read, {"type", "remote_read"}), F(type_remote_read_executing, {"type", "remote_read_executing"})) \ M(tiflash_coprocessor_executor_count, "Total number of each executor", Counter, F(type_ts, {"type", "table_scan"}), \ F(type_sel, {"type", "selection"}), F(type_agg, {"type", "aggregation"}), F(type_topn, {"type", "top_n"}), \ F(type_limit, {"type", "limit"}), F(type_join, {"type", "join"}), F(type_exchange_sender, {"type", "exchange_sender"}), \ @@ -61,14 +61,14 @@ namespace DB F(type_window, {"type", "window"}), F(type_window_sort, {"type", "window_sort"})) \ M(tiflash_coprocessor_request_duration_seconds, "Bucketed histogram of request duration", Histogram, \ F(type_cop, {{"type", "cop"}}, ExpBuckets{0.001, 2, 20}), \ - F(type_super_batch, {{"type", "super_batch"}}, ExpBuckets{0.001, 2, 20}), \ + F(type_batch, {{"type", "batch"}}, ExpBuckets{0.001, 2, 20}), \ F(type_dispatch_mpp_task, {{"type", "dispatch_mpp_task"}}, ExpBuckets{0.001, 2, 20}), \ F(type_mpp_establish_conn, {{"type", "mpp_establish_conn"}}, ExpBuckets{0.001, 2, 20}), \ F(type_cancel_mpp_task, {{"type", "cancel_mpp_task"}}, ExpBuckets{0.001, 2, 20}), \ F(type_run_mpp_task, {{"type", "run_mpp_task"}}, ExpBuckets{0.001, 2, 20})) \ M(tiflash_coprocessor_request_memory_usage, "Bucketed histogram of request memory usage", Histogram, \ F(type_cop, {{"type", "cop"}}, ExpBuckets{1024 * 1024, 2, 16}), \ - F(type_super_batch, {{"type", "super_batch"}}, ExpBuckets{1024 * 1024, 2, 20}), \ + F(type_batch, {{"type", "batch"}}, ExpBuckets{1024 * 1024, 2, 20}), \ F(type_run_mpp_task, {{"type", "run_mpp_task"}}, ExpBuckets{1024 * 1024, 2, 20})) \ M(tiflash_coprocessor_request_error, "Total number of request error", Counter, F(reason_meet_lock, {"reason", "meet_lock"}), \ F(reason_region_not_found, {"reason", "region_not_found"}), F(reason_epoch_not_match, {"reason", "epoch_not_match"}), \ @@ -76,7 +76,7 @@ namespace DB F(reason_other_error, {"reason", "other_error"})) \ M(tiflash_coprocessor_request_handle_seconds, "Bucketed histogram of request handle duration", Histogram, \ F(type_cop, {{"type", "cop"}}, ExpBuckets{0.001, 2, 20}), \ - F(type_super_batch, {{"type", "super_batch"}}, ExpBuckets{0.001, 2, 20}), \ + F(type_batch, {{"type", "batch"}}, ExpBuckets{0.001, 2, 20}), \ F(type_dispatch_mpp_task, {{"type", "dispatch_mpp_task"}}, ExpBuckets{0.001, 2, 20}), \ F(type_mpp_establish_conn, {{"type", "mpp_establish_conn"}}, ExpBuckets{0.001, 2, 20}), \ F(type_cancel_mpp_task, {{"type", "cancel_mpp_task"}}, ExpBuckets{0.001, 2, 20}), \ diff --git a/dbms/src/Flash/BatchCoprocessorHandler.cpp b/dbms/src/Flash/BatchCoprocessorHandler.cpp index b8aa0babb8f..b7dbcf153a1 100644 --- a/dbms/src/Flash/BatchCoprocessorHandler.cpp +++ b/dbms/src/Flash/BatchCoprocessorHandler.cpp @@ -44,7 +44,7 @@ BatchCoprocessorHandler::BatchCoprocessorHandler( grpc::Status BatchCoprocessorHandler::execute() { Stopwatch watch; - SCOPE_EXIT({ GET_METRIC(tiflash_coprocessor_request_handle_seconds, type_super_batch).Observe(watch.elapsedSeconds()); }); + SCOPE_EXIT({ GET_METRIC(tiflash_coprocessor_request_handle_seconds, type_batch).Observe(watch.elapsedSeconds()); }); try { @@ -52,10 +52,10 @@ grpc::Status BatchCoprocessorHandler::execute() { case COP_REQ_TYPE_DAG: { - GET_METRIC(tiflash_coprocessor_request_count, type_super_batch_cop_dag).Increment(); - GET_METRIC(tiflash_coprocessor_handling_request_count, type_super_batch_cop_dag).Increment(); + GET_METRIC(tiflash_coprocessor_request_count, type_batch_executing).Increment(); + GET_METRIC(tiflash_coprocessor_handling_request_count, type_batch_executing).Increment(); SCOPE_EXIT( - { GET_METRIC(tiflash_coprocessor_handling_request_count, type_super_batch_cop_dag).Decrement(); }); + { GET_METRIC(tiflash_coprocessor_handling_request_count, type_batch_executing).Decrement(); }); auto dag_request = getDAGRequestFromStringWithRetry(cop_request->data()); auto tables_regions_info = TablesRegionsInfo::create(cop_request->regions(), cop_request->table_regions(), cop_context.db_context.getTMTContext()); diff --git a/dbms/src/Flash/Coprocessor/DAGDriver.cpp b/dbms/src/Flash/Coprocessor/DAGDriver.cpp index 8a8d3af4407..b1a9bc55e42 100644 --- a/dbms/src/Flash/Coprocessor/DAGDriver.cpp +++ b/dbms/src/Flash/Coprocessor/DAGDriver.cpp @@ -151,7 +151,7 @@ try } else { - GET_METRIC(tiflash_coprocessor_request_memory_usage, type_super_batch).Observe(peak_memory); + GET_METRIC(tiflash_coprocessor_request_memory_usage, type_batch).Observe(peak_memory); } } diff --git a/dbms/src/Flash/CoprocessorHandler.cpp b/dbms/src/Flash/CoprocessorHandler.cpp index 312314cde92..706314fafb6 100644 --- a/dbms/src/Flash/CoprocessorHandler.cpp +++ b/dbms/src/Flash/CoprocessorHandler.cpp @@ -77,9 +77,9 @@ grpc::Status CoprocessorHandler::execute() { case COP_REQ_TYPE_DAG: { - GET_METRIC(tiflash_coprocessor_request_count, type_cop_dag).Increment(); - GET_METRIC(tiflash_coprocessor_handling_request_count, type_cop_dag).Increment(); - SCOPE_EXIT({ GET_METRIC(tiflash_coprocessor_handling_request_count, type_cop_dag).Decrement(); }); + GET_METRIC(tiflash_coprocessor_request_count, type_cop_executing).Increment(); + GET_METRIC(tiflash_coprocessor_handling_request_count, type_cop_executing).Increment(); + SCOPE_EXIT({ GET_METRIC(tiflash_coprocessor_handling_request_count, type_cop_executing).Decrement(); }); tipb::DAGRequest dag_request = getDAGRequestFromStringWithRetry(cop_request->data()); LOG_DEBUG(log, "Handling DAG request: {}", dag_request.DebugString()); diff --git a/dbms/src/Flash/FlashService.cpp b/dbms/src/Flash/FlashService.cpp index 59d99901428..cb6bf08a0e8 100644 --- a/dbms/src/Flash/FlashService.cpp +++ b/dbms/src/Flash/FlashService.cpp @@ -144,10 +144,10 @@ grpc::Status FlashService::Coprocessor( return status; } if (is_remote_read) - GET_METRIC(tiflash_coprocessor_handling_request_count, type_remote_read_dag).Increment(); + GET_METRIC(tiflash_coprocessor_handling_request_count, type_remote_read_executing).Increment(); SCOPE_EXIT({ if (is_remote_read) - GET_METRIC(tiflash_coprocessor_handling_request_count, type_remote_read_dag).Decrement(); + GET_METRIC(tiflash_coprocessor_handling_request_count, type_remote_read_executing).Decrement(); }); CoprocessorContext cop_context(*db_context, request->context(), *grpc_context); CoprocessorHandler cop_handler(cop_context, request, response); @@ -167,12 +167,12 @@ grpc::Status FlashService::BatchCoprocessor(grpc::ServerContext * grpc_context, if (!check_result.ok()) return check_result; - GET_METRIC(tiflash_coprocessor_request_count, type_super_batch).Increment(); - GET_METRIC(tiflash_coprocessor_handling_request_count, type_super_batch).Increment(); + GET_METRIC(tiflash_coprocessor_request_count, type_batch).Increment(); + GET_METRIC(tiflash_coprocessor_handling_request_count, type_batch).Increment(); Stopwatch watch; SCOPE_EXIT({ - GET_METRIC(tiflash_coprocessor_handling_request_count, type_super_batch).Decrement(); - GET_METRIC(tiflash_coprocessor_request_duration_seconds, type_super_batch).Observe(watch.elapsedSeconds()); + GET_METRIC(tiflash_coprocessor_handling_request_count, type_batch).Decrement(); + GET_METRIC(tiflash_coprocessor_request_duration_seconds, type_batch).Observe(watch.elapsedSeconds()); // TODO: update the value of metric tiflash_coprocessor_response_bytes. });