SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
metrics: disk size for <collection, normal/EC>
Chris Lu935639b9086b
diff --git a/weed/stats/metrics.go b/weed/stats/metrics.goindex 2408b607af..d487768afa 100644--- a/weed/stats/metrics.go+++ b/weed/stats/metrics.go@@ -60,23 +60,17 @@ var (prometheus.GaugeOpts{Namespace: "SeaweedFS",Subsystem: "volumeServer",- Name: "ecShards",+ Name: "ec_shards",Help: "Number of EC shards.",})- VolumeServerVolumeSizeGauge = prometheus.NewGauge(++ VolumeServerDiskSizeGauge = prometheus.NewGaugeVec(prometheus.GaugeOpts{Namespace: "SeaweedFS",Subsystem: "volumeServer",- Name: "totalVolumeSize",+ Name: "total_disk_size",Help: "Actual disk size used by volumes.",- })- VolumeServerEcShardSizeGauge = prometheus.NewGauge(- prometheus.GaugeOpts{- Namespace: "SeaweedFS",- Subsystem: "volumeServer",- Name: "totalEcShardSize",- Help: "Actual disk size used by ec shards.",- })+ }, []string{"collection", "type"}))func init() {@@ -88,8 +82,7 @@ func init() {VolumeServerGather.MustRegister(VolumeServerRequestHistogram)VolumeServerGather.MustRegister(VolumeServerVolumeCounter)VolumeServerGather.MustRegister(VolumeServerEcShardCounter)- VolumeServerGather.MustRegister(VolumeServerVolumeSizeGauge)- VolumeServerGather.MustRegister(VolumeServerEcShardSizeGauge)+ VolumeServerGather.MustRegister(VolumeServerDiskSizeGauge)}diff --git a/weed/storage/store.go b/weed/storage/store.goindex 1f1337e594..2d8be7be3d 100644--- a/weed/storage/store.go+++ b/weed/storage/store.go@@ -162,7 +162,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {var volumeMessages []*master_pb.VolumeInformationMessagemaxVolumeCount := 0var maxFileKey NeedleId- var totalVolumeSize uint64+ collectionVolumeSize := make(map[string]uint64)for _, location := range s.Locations {maxVolumeCount = maxVolumeCount + location.MaxVolumeCountlocation.Lock()@@ -181,11 +181,14 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {}}fileSize, _, _ := v.FileStat()- totalVolumeSize += fileSize+ collectionVolumeSize[v.Collection] += fileSize}location.Unlock()}- stats.VolumeServerVolumeSizeGauge.Set(float64(totalVolumeSize))++ for col, size := range collectionVolumeSize {+ stats.VolumeServerDiskSizeGauge.WithLabelValues(col, "normal").Set(float64(size))+ }return &master_pb.Heartbeat{Ip: s.Ip,diff --git a/weed/storage/store_ec.go b/weed/storage/store_ec.goindex d5e3610412..b39776dcf8 100644--- a/weed/storage/store_ec.go+++ b/weed/storage/store_ec.go@@ -20,20 +20,22 @@ import (func (s *Store) CollectErasureCodingHeartbeat() *master_pb.Heartbeat {var ecShardMessages []*master_pb.VolumeEcShardInformationMessage- var totalEcShardSize int64+ collectionEcShardSize := make(map[string]int64)for _, location := range s.Locations {location.ecVolumesLock.RLock()for _, ecShards := range location.ecVolumes {ecShardMessages = append(ecShardMessages, ecShards.ToVolumeEcShardInformationMessage()...)for _, ecShard := range ecShards.Shards {- totalEcShardSize += ecShard.Size()+ collectionEcShardSize[ecShards.Collection] += ecShard.Size()}}location.ecVolumesLock.RUnlock()}- stats.VolumeServerEcShardSizeGauge.Set(float64(totalEcShardSize))+ for col, size := range collectionEcShardSize {+ stats.VolumeServerDiskSizeGauge.WithLabelValues(col, "ec").Set(float64(size))+ }return &master_pb.Heartbeat{EcShards: ecShardMessages,