Browse Source

add stats raft handler

pull/2868/head
Konstantin Lebedev 3 years ago
parent
commit
622297f1a7
  1. 2
      weed/command/master.go
  2. 8
      weed/server/raft_server_handlers.go

2
weed/command/master.go

@ -177,7 +177,7 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) {
ms.SetRaftServer(raftServer)
r.HandleFunc("/cluster/status", raftServer.StatusHandler).Methods("GET")
if *m.raftHashicorp {
//r.HandleFunc("/raft/stats", raftServer.).Methods("GET")
r.HandleFunc("/raft/stats", raftServer.StatsRaftHandler).Methods("GET")
}
// starting grpc server
grpcPort := *masterOption.portGrpc

8
weed/server/raft_server_handlers.go

@ -25,3 +25,11 @@ func (s *RaftServer) StatusHandler(w http.ResponseWriter, r *http.Request) {
}
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…
Cancel
Save