Skip to content

Commit

Permalink
fix: fix loaded entity num is inaccurate (milvus-io#33521)
Browse files Browse the repository at this point in the history
issue: milvus-io#33520

Signed-off-by: jaime <[email protected]>
  • Loading branch information
jaime0815 authored Jun 4, 2024
1 parent d610fdf commit 8858fcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions internal/querynodev2/metrics_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand All @@ -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))
}

Expand Down Expand Up @@ -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))
}

Expand Down
1 change: 0 additions & 1 deletion pkg/metrics/querynode_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ var (
collectionIDLabelName,
partitionIDLabelName,
segmentStateLabelName,
indexCountLabelName,
})

QueryNodeEntitiesSize = prometheus.NewGaugeVec(
Expand Down

0 comments on commit 8858fcb

Please sign in to comment.