diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-06-10 06:44:16 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-10 06:44:16 -0700 |
| commit | 36757d28a8552c02187409c6d25e2c20f4a32b58 (patch) | |
| tree | 3e7a8219fb6e3e10bf4c52ed742d9b24bdf2535f /weed | |
| parent | 9f8b72a54d8c97db5963f5204e2857e93bf22612 (diff) | |
| parent | fb57aa431c52b7b5575e2eadd52ed3045d6c6c51 (diff) | |
| download | seaweedfs-36757d28a8552c02187409c6d25e2c20f4a32b58.tar.xz seaweedfs-36757d28a8552c02187409c6d25e2c20f4a32b58.zip | |
Merge pull request #3163 from kmlebedev/metric_replica_placement_mismatch
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 { |
