fix: Unify querynode metrics cleanup in collection release (#32805)

Related to #32803

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/32819/head
congqixia 2024-05-07 15:41:29 +08:00 committed by GitHub
parent 31dca3249e
commit efa0c73c62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 35 deletions

View File

@ -19,7 +19,6 @@ package pipeline
import (
"github.com/milvus-io/milvus/internal/querynodev2/delegator"
base "github.com/milvus-io/milvus/internal/util/pipeline"
"github.com/milvus-io/milvus/pkg/metrics"
"github.com/milvus-io/milvus/pkg/mq/msgdispatcher"
"github.com/milvus-io/milvus/pkg/util/paramtable"
)
@ -37,7 +36,6 @@ type pipeline struct {
func (p *pipeline) Close() {
p.StreamPipeline.Close()
metrics.CleanupQueryNodeCollectionMetrics(paramtable.GetNodeID(), p.collectionID)
}
func NewPipeLine(

View File

@ -25,7 +25,6 @@ package segments
import "C"
import (
"fmt"
"sync"
"unsafe"
@ -120,16 +119,8 @@ func (m *collectionManager) Unref(collectionID int64, count uint32) bool {
log.Info("release collection due to ref count to 0", zap.Int64("collectionID", collectionID))
delete(m.collections, collectionID)
DeleteCollection(collection)
metrics.QueryNodeEntitiesSize.DeleteLabelValues(
fmt.Sprint(paramtable.GetNodeID()),
fmt.Sprint(collectionID),
SegmentTypeSealed.String(),
)
metrics.QueryNodeEntitiesSize.DeleteLabelValues(
fmt.Sprint(paramtable.GetNodeID()),
fmt.Sprint(collectionID),
SegmentTypeGrowing.String(),
)
metrics.CleanupQueryNodeCollectionMetrics(paramtable.GetNodeID(), collectionID)
return true
}
return false

View File

@ -757,27 +757,31 @@ func RegisterQueryNode(registry *prometheus.Registry) {
}
func CleanupQueryNodeCollectionMetrics(nodeID int64, collectionID int64) {
for _, label := range []string{DeleteLabel, InsertLabel} {
QueryNodeConsumerMsgCount.
Delete(
prometheus.Labels{
nodeIDLabelName: fmt.Sprint(nodeID),
msgTypeLabelName: label,
collectionIDLabelName: fmt.Sprint(collectionID),
})
nodeIDLabel := fmt.Sprint(nodeID)
collectionIDLabel := fmt.Sprint(collectionID)
QueryNodeConsumerMsgCount.
DeletePartialMatch(
prometheus.Labels{
nodeIDLabelName: nodeIDLabel,
collectionIDLabelName: collectionIDLabel,
})
QueryNodeConsumeTimeTickLag.
Delete(
prometheus.Labels{
nodeIDLabelName: fmt.Sprint(nodeID),
msgTypeLabelName: label,
collectionIDLabelName: fmt.Sprint(collectionID),
})
QueryNodeNumEntities.
DeletePartialMatch(
prometheus.Labels{
nodeIDLabelName: fmt.Sprint(nodeID),
collectionIDLabelName: fmt.Sprint(collectionID),
})
}
QueryNodeConsumeTimeTickLag.
DeletePartialMatch(
prometheus.Labels{
nodeIDLabelName: nodeIDLabel,
collectionIDLabelName: collectionIDLabel,
})
QueryNodeNumEntities.
DeletePartialMatch(
prometheus.Labels{
nodeIDLabelName: nodeIDLabel,
collectionIDLabelName: collectionIDLabel,
})
QueryNodeEntitiesSize.
DeletePartialMatch(
prometheus.Labels{
nodeIDLabelName: nodeIDLabel,
collectionIDLabelName: collectionIDLabel,
})
}