fix: fix loaded entity num is inaccurate (#33522)

issue: #33520

Signed-off-by: jaime <yun.zhang@zilliz.com>
pull/33597/head^2
jaime 2024-06-04 20:09:54 +08:00 committed by GitHub
parent 44e97b7cda
commit 0ad55c6c44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 5 deletions

View File

@ -103,11 +103,12 @@ func getQuotaMetrics(node *QueryNode) (*metricsinfo.QueryNodeQuotaMetrics, error
}
minTsafeChannel, minTsafe := node.tSafeManager.Min()
collections := node.manager.Collection.List()
nodeID := fmt.Sprint(node.GetNodeID())
metrics.QueryNodeNumEntities.Reset()
metrics.QueryNodeEntitiesSize.Reset()
var totalGrowingSize int64
growingSegments := node.manager.Segment.GetBy(segments.WithType(segments.SegmentTypeGrowing))
growingGroupByCollection := lo.GroupBy(growingSegments, func(seg segments.Segment) int64 {
@ -125,6 +126,7 @@ func getQuotaMetrics(node *QueryNode) (*metricsinfo.QueryNodeQuotaMetrics, error
growingGroupByPartition := lo.GroupBy(growingSegments, func(seg segments.Segment) int64 {
return seg.Partition()
})
for _, segs := range growingGroupByPartition {
numEntities := lo.SumBy(segs, func(seg segments.Segment) int64 {
return seg.RowNum()
@ -136,7 +138,6 @@ func getQuotaMetrics(node *QueryNode) (*metricsinfo.QueryNodeQuotaMetrics, error
fmt.Sprint(segment.Collection()),
fmt.Sprint(segment.Partition()),
segments.SegmentTypeGrowing.String(),
fmt.Sprint(len(segment.Indexes())),
).Set(float64(numEntities))
}
@ -166,7 +167,6 @@ func getQuotaMetrics(node *QueryNode) (*metricsinfo.QueryNodeQuotaMetrics, error
fmt.Sprint(segment.Collection()),
fmt.Sprint(segment.Partition()),
segments.SegmentTypeSealed.String(),
fmt.Sprint(len(segment.Indexes())),
).Set(float64(numEntities))
}

View File

@ -370,7 +370,6 @@ var (
collectionIDLabelName,
partitionIDLabelName,
segmentStateLabelName,
indexCountLabelName,
})
QueryNodeEntitiesSize = prometheus.NewGaugeVec(