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()
|
m.RLock()
|
||||||
defer m.RUnlock()
|
defer m.RUnlock()
|
||||||
collectionBinlogSize := make(map[UniqueID]int64)
|
collectionBinlogSize := make(map[UniqueID]int64)
|
||||||
sizesOfStates := make(map[commonpb.SegmentState]int64)
|
|
||||||
segments := m.segments.GetSegments()
|
segments := m.segments.GetSegments()
|
||||||
var total int64
|
var total int64
|
||||||
for _, segment := range segments {
|
for _, segment := range segments {
|
||||||
|
@ -266,10 +265,8 @@ func (m *meta) GetCollectionBinlogSize() (int64, map[UniqueID]int64) {
|
||||||
total += segmentSize
|
total += segmentSize
|
||||||
collectionBinlogSize[segment.GetCollectionID()] += segmentSize
|
collectionBinlogSize[segment.GetCollectionID()] += segmentSize
|
||||||
}
|
}
|
||||||
sizesOfStates[segment.GetState()] += segmentSize
|
metrics.DataCoordStoredBinlogSize.WithLabelValues(
|
||||||
}
|
fmt.Sprint(segment.GetCollectionID()), fmt.Sprint(segment.GetID())).Set(float64(segmentSize))
|
||||||
for state, size := range sizesOfStates {
|
|
||||||
metrics.DataCoordStoredBinlogSize.WithLabelValues(state.String()).Set(float64(size))
|
|
||||||
}
|
}
|
||||||
return total, collectionBinlogSize
|
return total, collectionBinlogSize
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,10 @@ var (
|
||||||
Subsystem: typeutil.DataCoordRole,
|
Subsystem: typeutil.DataCoordRole,
|
||||||
Name: "stored_binlog_size",
|
Name: "stored_binlog_size",
|
||||||
Help: "binlog size of segments",
|
Help: "binlog size of segments",
|
||||||
}, []string{segmentStateLabelName})
|
}, []string{
|
||||||
|
collectionIDLabelName,
|
||||||
|
segmentIDLabelName,
|
||||||
|
})
|
||||||
|
|
||||||
DataCoordSegmentBinLogFileCount = prometheus.NewGaugeVec(
|
DataCoordSegmentBinLogFileCount = prometheus.NewGaugeVec(
|
||||||
prometheus.GaugeOpts{
|
prometheus.GaugeOpts{
|
||||||
|
@ -204,4 +207,8 @@ func CleanupDataCoordSegmentMetrics(collectionID int64, segmentID int64) {
|
||||||
collectionIDLabelName: fmt.Sprint(collectionID),
|
collectionIDLabelName: fmt.Sprint(collectionID),
|
||||||
segmentIDLabelName: fmt.Sprint(segmentID),
|
segmentIDLabelName: fmt.Sprint(segmentID),
|
||||||
})
|
})
|
||||||
|
DataCoordStoredBinlogSize.Delete(prometheus.Labels{
|
||||||
|
collectionIDLabelName: fmt.Sprint(collectionID),
|
||||||
|
segmentIDLabelName: fmt.Sprint(segmentID),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue