enhance: Remove metrics when target removed (#31399)

See also #31390

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2024-03-20 10:09:08 +08:00 committed by GitHub
parent 2b7df47aa9
commit c3d53eb1bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -278,6 +278,16 @@ func (mgr *TargetManager) RemoveCollection(collectionID int64) {
log.Info("remove collection from targets",
zap.Int64("collectionID", collectionID))
current := mgr.current.getCollectionTarget(collectionID)
if current != nil {
for channelName := range current.GetAllDmChannels() {
metrics.QueryCoordCurrentTargetCheckpointUnixSeconds.DeleteLabelValues(
fmt.Sprint(paramtable.GetNodeID()),
channelName,
)
}
}
mgr.current.removeCollectionTarget(collectionID)
mgr.next.removeCollectionTarget(collectionID)
}