mirror of https://github.com/milvus-io/milvus.git
Improve the metric of stored binlog size to the level of collection and segment (#23859)
Signed-off-by: bigsheeper <yihao.dai@zilliz.com>pull/23919/head
parent
ad75afdcd1
commit
fc010ee86b
|
@ -257,7 +257,6 @@ func (m *meta) GetCollectionBinlogSize() (int64, map[UniqueID]int64) {
|
|||
m.RLock()
|
||||
defer m.RUnlock()
|
||||
collectionBinlogSize := make(map[UniqueID]int64)
|
||||
sizesOfStates := make(map[commonpb.SegmentState]int64)
|
||||
segments := m.segments.GetSegments()
|
||||
var total int64
|
||||
for _, segment := range segments {
|
||||
|
@ -266,10 +265,8 @@ func (m *meta) GetCollectionBinlogSize() (int64, map[UniqueID]int64) {
|
|||
total += segmentSize
|
||||
collectionBinlogSize[segment.GetCollectionID()] += segmentSize
|
||||
}
|
||||
sizesOfStates[segment.GetState()] += segmentSize
|
||||
}
|
||||
for state, size := range sizesOfStates {
|
||||
metrics.DataCoordStoredBinlogSize.WithLabelValues(state.String()).Set(float64(size))
|
||||
metrics.DataCoordStoredBinlogSize.WithLabelValues(
|
||||
fmt.Sprint(segment.GetCollectionID()), fmt.Sprint(segment.GetID())).Set(float64(segmentSize))
|
||||
}
|
||||
return total, collectionBinlogSize
|
||||
}
|
||||
|
|
|
@ -96,7 +96,10 @@ var (
|
|||
Subsystem: typeutil.DataCoordRole,
|
||||
Name: "stored_binlog_size",
|
||||
Help: "binlog size of segments",
|
||||
}, []string{segmentStateLabelName})
|
||||
}, []string{
|
||||
collectionIDLabelName,
|
||||
segmentIDLabelName,
|
||||
})
|
||||
|
||||
DataCoordSegmentBinLogFileCount = prometheus.NewGaugeVec(
|
||||
prometheus.GaugeOpts{
|
||||
|
@ -204,4 +207,8 @@ func CleanupDataCoordSegmentMetrics(collectionID int64, segmentID int64) {
|
|||
collectionIDLabelName: fmt.Sprint(collectionID),
|
||||
segmentIDLabelName: fmt.Sprint(segmentID),
|
||||
})
|
||||
DataCoordStoredBinlogSize.Delete(prometheus.Labels{
|
||||
collectionIDLabelName: fmt.Sprint(collectionID),
|
||||
segmentIDLabelName: fmt.Sprint(segmentID),
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue