aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Lebedev <lebedev_k@tochka.com>2020-10-15 15:32:02 +0500
committerKonstantin Lebedev <lebedev_k@tochka.com>2020-10-15 15:48:40 +0500
commitdc2e13092da98762c2eb35601a95d393a1acc03f (patch)
treef5ebcd1bfd2a1ff768b11872dac301ee0c3e44f4
parente714c28a02bfe389229ed079477ead64f7b129c0 (diff)
downloadseaweedfs-dc2e13092da98762c2eb35601a95d393a1acc03f.tar.xz
seaweedfs-dc2e13092da98762c2eb35601a95d393a1acc03f.zip
add number of read only volumes metric
-rw-r--r--weed/stats/metrics.go9
-rw-r--r--weed/storage/store.go8
2 files changed, 17 insertions, 0 deletions
diff --git a/weed/stats/metrics.go b/weed/stats/metrics.go
index a60cda290..13ab3bae1 100644
--- a/weed/stats/metrics.go
+++ b/weed/stats/metrics.go
@@ -77,6 +77,14 @@ var (
Help: "Number of volumes or shards.",
}, []string{"collection", "type"})
+ VolumeServerReadOnlyVolumeGauge = prometheus.NewGaugeVec(
+ prometheus.GaugeOpts{
+ Namespace: "SeaweedFS",
+ Subsystem: "volumeServer",
+ Name: "read_only_volumes",
+ Help: "Number of read only volumes.",
+ }, []string{"collection", "type"})
+
VolumeServerMaxVolumeCounter = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "SeaweedFS",
@@ -122,6 +130,7 @@ func init() {
Gather.MustRegister(VolumeServerRequestHistogram)
Gather.MustRegister(VolumeServerVolumeCounter)
Gather.MustRegister(VolumeServerMaxVolumeCounter)
+ Gather.MustRegister(VolumeServerReadOnlyVolumeGauge)
Gather.MustRegister(VolumeServerDiskSizeGauge)
Gather.MustRegister(S3RequestCounter)
diff --git a/weed/storage/store.go b/weed/storage/store.go
index d5d59235a..72a388379 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -200,6 +200,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
maxVolumeCount := 0
var maxFileKey NeedleId
collectionVolumeSize := make(map[string]uint64)
+ collectionVolumeReadOnlyCount := make(map[string]uint8)
for _, location := range s.Locations {
var deleteVids []needle.VolumeId
maxVolumeCount = maxVolumeCount + location.MaxVolumeCount
@@ -219,6 +220,9 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
}
fileSize, _, _ := v.FileStat()
collectionVolumeSize[v.Collection] += fileSize
+ if v.IsReadOnly() {
+ collectionVolumeReadOnlyCount[v.Collection] += 1
+ }
}
location.volumesLock.RUnlock()
@@ -243,6 +247,10 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
stats.VolumeServerDiskSizeGauge.WithLabelValues(col, "normal").Set(float64(size))
}
+ for col, count := range collectionVolumeReadOnlyCount {
+ stats.VolumeServerReadOnlyVolumeGauge.WithLabelValues(col, "normal").Set(float64(count))
+ }
+
return &master_pb.Heartbeat{
Ip: s.Ip,
Port: uint32(s.Port),