From 78e6d337ee6367b2055df867f3e21c20bfbe440a Mon Sep 17 00:00:00 2001 From: Calvin Neo Date: Wed, 20 Nov 2024 17:38:45 +0800 Subject: [PATCH] Distinguish different vector index build type (#320) Signed-off-by: Calvin Neo --- dbms/src/Common/TiFlashMetrics.h | 5 +++++ dbms/src/Storages/DeltaMerge/LocalIndexerScheduler.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/dbms/src/Common/TiFlashMetrics.h b/dbms/src/Common/TiFlashMetrics.h index 93d56d9f334..95ba6f7d0d8 100644 --- a/dbms/src/Common/TiFlashMetrics.h +++ b/dbms/src/Common/TiFlashMetrics.h @@ -860,6 +860,11 @@ static_assert(RAFT_REGION_BIG_WRITE_THRES * 4 < RAFT_REGION_BIG_WRITE_MAX, "Inva Gauge, \ F(type_build, {"type", "build"}), \ F(type_view, {"type", "view"})) \ + M(tiflash_vector_index_build_count, \ + "Vector index build count", \ + Counter, \ + F(type_stable, {"type", "stable"}), \ + F(type_delta, {"type", "delta"})) \ M(tiflash_vector_index_active_instances, \ "Active Vector index instances", \ Gauge, \ diff --git a/dbms/src/Storages/DeltaMerge/LocalIndexerScheduler.cpp b/dbms/src/Storages/DeltaMerge/LocalIndexerScheduler.cpp index 15ca84b8002..403de8731c5 100644 --- a/dbms/src/Storages/DeltaMerge/LocalIndexerScheduler.cpp +++ b/dbms/src/Storages/DeltaMerge/LocalIndexerScheduler.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include #include #include @@ -194,6 +195,10 @@ void LocalIndexerScheduler::taskOnSchedule(std::unique_lock &, const { for (const auto & file_id : task->user_task.file_ids) { + if (std::holds_alternative(file_id)) + GET_METRIC(tiflash_vector_index_build_count, type_stable).Increment(1); + else + GET_METRIC(tiflash_vector_index_build_count, type_delta).Increment(1); auto [it, inserted] = adding_index_page_id_set.insert(file_id); RUNTIME_CHECK(inserted); UNUSED(it);