diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2022-06-10 15:30:40 +0500 |
|---|---|---|
| committer | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2022-06-10 15:30:40 +0500 |
| commit | fb57aa431c52b7b5575e2eadd52ed3045d6c6c51 (patch) | |
| tree | b52969a017c67d03c157e131fa57a917632848ce /weed | |
| parent | 4a5135961f71fa3b9a3b9b9267cf20e92372a8ec (diff) | |
| download | seaweedfs-fb57aa431c52b7b5575e2eadd52ed3045d6c6c51.tar.xz seaweedfs-fb57aa431c52b7b5575e2eadd52ed3045d6c6c51.zip | |
stats master_replica_placement_mismatch
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/stats/metrics.go | 9 | ||||
| -rw-r--r-- | weed/topology/node.go | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/weed/stats/metrics.go b/weed/stats/metrics.go index 8381999c2..943aafff9 100644 --- a/weed/stats/metrics.go +++ b/weed/stats/metrics.go @@ -44,6 +44,14 @@ var ( Help: "Counter of master received heartbeat.", }, []string{"type"}) + MasterReplicaPlacementMismatch = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Namespace: "SeaweedFS", + Subsystem: "master", + Name: "replica_placement_mismatch", + Help: "replica placement mismatch", + }, []string{"collection", "id"}) + MasterLeaderChangeCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: "SeaweedFS", @@ -165,6 +173,7 @@ func init() { Gather.MustRegister(MasterRaftIsleader) Gather.MustRegister(MasterReceivedHeartbeatCounter) Gather.MustRegister(MasterLeaderChangeCounter) + Gather.MustRegister(MasterReplicaPlacementMismatch) Gather.MustRegister(FilerRequestCounter) Gather.MustRegister(FilerRequestHistogram) diff --git a/weed/topology/node.go b/weed/topology/node.go index 4772cb411..c5956177a 100644 --- a/weed/topology/node.go +++ b/weed/topology/node.go @@ -3,6 +3,7 @@ package topology import ( "errors" "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/chrislusf/seaweedfs/weed/stats" "github.com/chrislusf/seaweedfs/weed/storage/erasure_coding" "github.com/chrislusf/seaweedfs/weed/storage/needle" "github.com/chrislusf/seaweedfs/weed/storage/types" @@ -246,6 +247,14 @@ func (n *NodeImpl) CollectDeadNodeAndFullVolumes(freshThreshHold int64, volumeSi } else if float64(v.Size) > float64(volumeSizeLimit)*growThreshold { n.GetTopology().chanCrowdedVolumes <- v } + copyCount := v.ReplicaPlacement.GetCopyCount() + if copyCount > 1 { + if copyCount > len(n.GetTopology().Lookup(v.Collection, v.Id)) { + stats.MasterReplicaPlacementMismatch.WithLabelValues(v.Collection, v.Id.String()).Set(1) + } else { + stats.MasterReplicaPlacementMismatch.WithLabelValues(v.Collection, v.Id.String()).Set(0) + } + } } } } else { |
