mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-05-15 20:49:42 +08:00
Add deleted bytes to total_disk_size (#5161)
This commit is contained in:
parent
3e3e0fa240
commit
ecc154fa9e
@ -251,6 +251,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||
maxVolumeCounts := make(map[string]uint32)
|
||||
var maxFileKey NeedleId
|
||||
collectionVolumeSize := make(map[string]int64)
|
||||
collectionVolumeDeletedBytes := make(map[string]int64)
|
||||
collectionVolumeReadOnlyCount := make(map[string]map[string]uint8)
|
||||
for _, location := range s.Locations {
|
||||
var deleteVids []needle.VolumeId
|
||||
@ -283,9 +284,11 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||
|
||||
if _, exist := collectionVolumeSize[v.Collection]; !exist {
|
||||
collectionVolumeSize[v.Collection] = 0
|
||||
collectionVolumeDeletedBytes[v.Collection] = 0
|
||||
}
|
||||
if !shouldDeleteVolume {
|
||||
collectionVolumeSize[v.Collection] += int64(volumeMessage.Size)
|
||||
collectionVolumeDeletedBytes[v.Collection] += int64(volumeMessage.DeletedByteCount)
|
||||
} else {
|
||||
collectionVolumeSize[v.Collection] -= int64(volumeMessage.Size)
|
||||
if collectionVolumeSize[v.Collection] <= 0 {
|
||||
@ -342,6 +345,10 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||
stats.VolumeServerDiskSizeGauge.WithLabelValues(col, "normal").Set(float64(size))
|
||||
}
|
||||
|
||||
for col, deletedBytes := range collectionVolumeDeletedBytes{
|
||||
stats.VolumeServerDiskSizeGauge.WithLabelValues(col, "deleted_bytes").Set(float64(deletedBytes))
|
||||
}
|
||||
|
||||
for col, types := range collectionVolumeReadOnlyCount {
|
||||
for t, count := range types {
|
||||
stats.VolumeServerReadOnlyVolumeGauge.WithLabelValues(col, t).Set(float64(count))
|
||||
|
Loading…
Reference in New Issue
Block a user