mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add stats raft handler
This commit is contained in:
parent
1a1e5778c3
commit
622297f1a7
|
@ -177,7 +177,7 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) {
|
||||||
ms.SetRaftServer(raftServer)
|
ms.SetRaftServer(raftServer)
|
||||||
r.HandleFunc("/cluster/status", raftServer.StatusHandler).Methods("GET")
|
r.HandleFunc("/cluster/status", raftServer.StatusHandler).Methods("GET")
|
||||||
if *m.raftHashicorp {
|
if *m.raftHashicorp {
|
||||||
//r.HandleFunc("/raft/stats", raftServer.).Methods("GET")
|
r.HandleFunc("/raft/stats", raftServer.StatsRaftHandler).Methods("GET")
|
||||||
}
|
}
|
||||||
// starting grpc server
|
// starting grpc server
|
||||||
grpcPort := *masterOption.portGrpc
|
grpcPort := *masterOption.portGrpc
|
||||||
|
|
|
@ -25,3 +25,11 @@ func (s *RaftServer) StatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
writeJsonQuiet(w, r, http.StatusOK, ret)
|
writeJsonQuiet(w, r, http.StatusOK, ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *RaftServer) StatsRaftHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if s.RaftHashicorp == nil {
|
||||||
|
writeJsonQuiet(w, r, http.StatusNotFound, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
writeJsonQuiet(w, r, http.StatusOK, s.RaftHashicorp.Stats())
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue