From 370562b4ec3078e58a574c33e1cf7e4012af7cb3 Mon Sep 17 00:00:00 2001 From: Bingyi Sun Date: Fri, 24 May 2024 15:31:42 +0800 Subject: [PATCH] fix: fix partition loaded num metric (#33316) issue: https://github.com/milvus-io/milvus/issues/32108 Signed-off-by: sunby --- internal/querynodev2/segments/manager.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/querynodev2/segments/manager.go b/internal/querynodev2/segments/manager.go index c0b890257f..4a8cd52bae 100644 --- a/internal/querynodev2/segments/manager.go +++ b/internal/querynodev2/segments/manager.go @@ -36,6 +36,7 @@ import ( "github.com/milvus-io/milvus/internal/proto/datapb" "github.com/milvus-io/milvus/internal/proto/querypb" "github.com/milvus-io/milvus/internal/querynodev2/segments/metricsutil" + "github.com/milvus-io/milvus/pkg/common" "github.com/milvus-io/milvus/pkg/eventlog" "github.com/milvus-io/milvus/pkg/log" "github.com/milvus-io/milvus/pkg/metrics" @@ -723,11 +724,15 @@ func (mgr *segmentManager) updateMetric() { collections, partiations := make(typeutil.Set[int64]), make(typeutil.Set[int64]) for _, seg := range mgr.growingSegments { collections.Insert(seg.Collection()) - partiations.Insert(seg.Partition()) + if seg.Partition() != common.AllPartitionsID { + partiations.Insert(seg.Partition()) + } } for _, seg := range mgr.sealedSegments { collections.Insert(seg.Collection()) - partiations.Insert(seg.Partition()) + if seg.Partition() != common.AllPartitionsID { + partiations.Insert(seg.Partition()) + } } metrics.QueryNodeNumCollections.WithLabelValues(fmt.Sprint(paramtable.GetNodeID())).Set(float64(collections.Len())) metrics.QueryNodeNumPartitions.WithLabelValues(fmt.Sprint(paramtable.GetNodeID())).Set(float64(partiations.Len()))