Skip to content

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.

Export `master_disconnections` metrics on volume servers. (#9104)

Lisandro Pin6bcacedda9df
diff --git a/weed/server/volume_grpc_client_to_master.go b/weed/server/volume_grpc_client_to_master.go
index 6258da9c76..6214711e48 100644
--- a/weed/server/volume_grpc_client_to_master.go
+++ b/weed/server/volume_grpc_client_to_master.go
@@ -7,6 +7,7 @@ import (
"time"
"github.com/seaweedfs/seaweedfs/weed/operation"
+ "github.com/seaweedfs/seaweedfs/weed/stats"
"google.golang.org/grpc"
@@ -84,6 +85,7 @@ func (vs *VolumeServer) heartbeat() {
time.Sleep(vs.pulsePeriod)
}
+ stats.VolumeServerMasterDisconnections.WithLabelValues(master.String()).Inc()
newLeader = ""
vs.store.MasterAddress = ""
} else {
diff --git a/weed/stats/metrics.go b/weed/stats/metrics.go
index 4cb53a5946..b2c056153e 100644
--- a/weed/stats/metrics.go
+++ b/weed/stats/metrics.go
@@ -362,6 +362,14 @@ var (
Help: "In flight total upload size.",
})
+ VolumeServerMasterDisconnections = prometheus.NewCounterVec(
+ prometheus.CounterOpts{
+ Namespace: Namespace,
+ Subsystem: "volumeServer",
+ Name: "master_disconnections",
+ Help: "Number of master server disconnections.",
+ }, []string{"address"})
+
S3RequestCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: Namespace,
@@ -528,6 +536,7 @@ func init() {
Gather.MustRegister(VolumeServerConcurrentUploadLimit)
Gather.MustRegister(VolumeServerInFlightDownloadSize)
Gather.MustRegister(VolumeServerInFlightUploadSize)
+ Gather.MustRegister(VolumeServerMasterDisconnections)
Gather.MustRegister(S3RequestCounter)
Gather.MustRegister(S3HandlerCounter)