Skip to content

Commit 7275a8c

Browse files
vector: Distinguish different vector index build type by metrics (#9769) (#9773)
close #9770 Signed-off-by: Calvin Neo <calvinneo1995@gmail.com> Co-authored-by: Calvin Neo <CalvinNeo@users.noreply.github.com>
1 parent caf7b84 commit 7275a8c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

dbms/src/Common/TiFlashMetrics.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,11 @@ static_assert(RAFT_REGION_BIG_WRITE_THRES * 4 < RAFT_REGION_BIG_WRITE_MAX, "Inva
860860
Gauge, \
861861
F(type_build, {"type", "build"}), \
862862
F(type_view, {"type", "view"})) \
863+
M(tiflash_vector_index_build_count, \
864+
"Vector index build count", \
865+
Counter, \
866+
F(type_stable, {"type", "stable"}), \
867+
F(type_delta, {"type", "delta"})) \
863868
M(tiflash_vector_index_active_instances, \
864869
"Active Vector index instances", \
865870
Gauge, \

dbms/src/Storages/DeltaMerge/LocalIndexerScheduler.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
#include <Common/Exception.h>
16+
#include <Common/TiFlashMetrics.h>
1617
#include <Common/setThreadName.h>
1718
#include <Storages/DeltaMerge/LocalIndexerScheduler.h>
1819
#include <common/logger_useful.h>
@@ -194,6 +195,10 @@ void LocalIndexerScheduler::taskOnSchedule(std::unique_lock<std::mutex> &, const
194195
{
195196
for (const auto & file_id : task->user_task.file_ids)
196197
{
198+
if (std::holds_alternative<DMFileID>(file_id))
199+
GET_METRIC(tiflash_vector_index_build_count, type_stable).Increment(1);
200+
else
201+
GET_METRIC(tiflash_vector_index_build_count, type_delta).Increment(1);
197202
auto [it, inserted] = adding_index_page_id_set.insert(file_id);
198203
RUNTIME_CHECK(inserted);
199204
UNUSED(it);

0 commit comments

Comments
 (0)