fix: Update disk usage metrics after segment released (#30702)

See also #30701

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/30718/head
congqixia 2024-02-20 22:14:53 +08:00 committed by GitHub
parent 4a1d562d4a
commit e5a16050ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -1264,6 +1264,12 @@ func (s *LocalSegment) Release() {
strconv.FormatInt(int64(len(s.Indexes())), 10),
).Sub(float64(s.InsertCount()))
localDiskUsage, err := GetLocalUsedSize(context.Background(), paramtable.Get().LocalStorageCfg.Path.GetValue())
// ignore error here, shall not block releasing
if err == nil {
metrics.QueryNodeDiskUsedSize.WithLabelValues(fmt.Sprint(paramtable.GetNodeID())).Set(float64(localDiskUsage) / 1024 / 1024) // in MB
}
log.Info("delete segment from memory",
zap.Int64("collectionID", s.collectionID),
zap.Int64("partitionID", s.partitionID),