mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix: metrics stored_index_files_size is never cleared (#36160)
issue: #36159 Signed-off-by: jaime <yun.zhang@zilliz.com>
This commit is contained in:
parent
58d3200986
commit
22cce44afc
@ -466,11 +466,13 @@ func (m *meta) GetQuotaInfo() *metricsinfo.DataCoordQuotaMetrics {
|
||||
return info
|
||||
}
|
||||
|
||||
// GetCollectionIndexFilesSize returns the total index files size of all segment for each collection.
|
||||
func (m *meta) GetCollectionIndexFilesSize() uint64 {
|
||||
// SetStoredIndexFileSizeMetric returns the total index files size of all segment for each collection.
|
||||
func (m *meta) SetStoredIndexFileSizeMetric() uint64 {
|
||||
m.RLock()
|
||||
defer m.RUnlock()
|
||||
var total uint64
|
||||
|
||||
metrics.DataCoordStoredIndexFilesSize.Reset()
|
||||
for _, segmentIdx := range m.indexMeta.GetAllSegIndexes() {
|
||||
coll, ok := m.collections[segmentIdx.CollectionID]
|
||||
if ok {
|
||||
|
||||
@ -604,7 +604,7 @@ func TestMeta_Basic(t *testing.T) {
|
||||
|
||||
t.Run("Test GetCollectionBinlogSize", func(t *testing.T) {
|
||||
meta := createMeta(&datacoord.Catalog{}, withIndexMeta(createIndexMeta(&datacoord.Catalog{})))
|
||||
ret := meta.GetCollectionIndexFilesSize()
|
||||
ret := meta.SetStoredIndexFileSizeMetric()
|
||||
assert.Equal(t, uint64(0), ret)
|
||||
|
||||
meta.collections = map[UniqueID]*collectionInfo{
|
||||
@ -613,7 +613,7 @@ func TestMeta_Basic(t *testing.T) {
|
||||
DatabaseName: "db",
|
||||
},
|
||||
}
|
||||
ret = meta.GetCollectionIndexFilesSize()
|
||||
ret = meta.SetStoredIndexFileSizeMetric()
|
||||
assert.Equal(t, uint64(11), ret)
|
||||
})
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ import (
|
||||
func (s *Server) getQuotaMetrics() *metricsinfo.DataCoordQuotaMetrics {
|
||||
info := s.meta.GetQuotaInfo()
|
||||
// Just generate the metrics data regularly
|
||||
_ = s.meta.GetCollectionIndexFilesSize()
|
||||
_ = s.meta.SetStoredIndexFileSizeMetric()
|
||||
return info
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user