fix: fix partition loaded num metric (#33316)

issue: https://github.com/milvus-io/milvus/issues/32108

Signed-off-by: sunby <sunbingyi1992@gmail.com>
pull/33348/head
Bingyi Sun 2024-05-24 15:31:42 +08:00 committed by GitHub
parent 3c7d0209d4
commit 370562b4ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -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,12 +724,16 @@ func (mgr *segmentManager) updateMetric() {
collections, partiations := make(typeutil.Set[int64]), make(typeutil.Set[int64])
for _, seg := range mgr.growingSegments {
collections.Insert(seg.Collection())
if seg.Partition() != common.AllPartitionsID {
partiations.Insert(seg.Partition())
}
}
for _, seg := range mgr.sealedSegments {
collections.Insert(seg.Collection())
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()))
}