From 4493aa2142ec9f05fdf4f923f5931d719eedf558 Mon Sep 17 00:00:00 2001 From: sthuang <167743503+shaoting-huang@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:23:13 +0800 Subject: [PATCH] fix: querycoord collection num metric (#36471) related to: #36456 Signed-off-by: shaoting-huang --- internal/querycoordv2/meta/collection_manager.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/querycoordv2/meta/collection_manager.go b/internal/querycoordv2/meta/collection_manager.go index 3ad7f8984ac2a..085bc901e89db 100644 --- a/internal/querycoordv2/meta/collection_manager.go +++ b/internal/querycoordv2/meta/collection_manager.go @@ -582,9 +582,7 @@ func (m *CollectionManager) UpdateLoadPercent(partitionID int64, loadPercent int // if collection becomes loaded, clear it's recoverTimes in load info newCollection.RecoverTimes = 0 - // TODO: what if part of the collection has been unloaded? Now we decrease the metric only after - // `ReleaseCollection` is triggered. Maybe it's hard to make this metric really accurate. - metrics.QueryCoordNumCollections.WithLabelValues().Inc() + metrics.QueryCoordNumCollections.WithLabelValues().Set(float64(len(lo.Values(m.collections)))) elapsed := time.Since(newCollection.CreatedAt) metrics.QueryCoordLoadLatency.WithLabelValues().Observe(float64(elapsed.Milliseconds())) eventlog.Record(eventlog.NewRawEvt(eventlog.Level_Info, fmt.Sprintf("Collection %d loaded", newCollection.CollectionID)))