mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
metrics master is leader
This commit is contained in:
parent
28efe31524
commit
c9952759c4
|
@ -237,7 +237,10 @@ func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServ
|
|||
}
|
||||
case <-ticker.C:
|
||||
if !ms.Topo.IsLeader() {
|
||||
stats.MasterRaftIsleader.Set(0)
|
||||
return ms.informNewLeader(stream)
|
||||
} else {
|
||||
stats.MasterRaftIsleader.Set(1)
|
||||
}
|
||||
case <-stopChan:
|
||||
return nil
|
||||
|
|
|
@ -28,6 +28,14 @@ var (
|
|||
Help: "Counter of master client leader updates.",
|
||||
}, []string{"type"})
|
||||
|
||||
MasterRaftIsleader = prometheus.NewGauge(
|
||||
prometheus.GaugeOpts{
|
||||
Namespace: "SeaweedFS",
|
||||
Subsystem: "master",
|
||||
Name: "is leader",
|
||||
Help: "is leader",
|
||||
})
|
||||
|
||||
MasterReceivedHeartbeatCounter = prometheus.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
Namespace: "SeaweedFS",
|
||||
|
@ -153,6 +161,11 @@ var (
|
|||
)
|
||||
|
||||
func init() {
|
||||
Gather.MustRegister(MasterClientConnectCounter)
|
||||
Gather.MustRegister(MasterRaftIsleader)
|
||||
Gather.MustRegister(MasterReceivedHeartbeatCounter)
|
||||
Gather.MustRegister(MasterLeaderChangeCounter)
|
||||
|
||||
Gather.MustRegister(FilerRequestCounter)
|
||||
Gather.MustRegister(FilerRequestHistogram)
|
||||
Gather.MustRegister(FilerStoreCounter)
|
||||
|
|
Loading…
Reference in a new issue