consul: Passthrough the Serf Stats()

This commit is contained in:
Armon Dadgar 2014-02-23 18:08:58 -08:00
parent 76ec9d22b1
commit 1b1cb3be11
2 changed files with 10 additions and 16 deletions

View File

@ -317,12 +317,10 @@ func (c *Client) Stats() map[string]map[string]string {
}
stats := map[string]map[string]string{
"consul": map[string]string{
"server": "false",
},
"serf-lan": map[string]string{
"members": toString(uint64(len(c.serf.Members()))),
"servers": toString(uint64(len(c.consuls))),
"server": "false",
"known_servers": toString(uint64(len(c.consuls))),
},
"serf-lan": c.serf.Stats(),
}
return stats
}

View File

@ -462,18 +462,14 @@ func (s *Server) Stats() map[string]map[string]string {
}
stats := map[string]map[string]string{
"consul": map[string]string{
"server": "true",
"leader": fmt.Sprintf("%v", s.IsLeader()),
"bootstrap": fmt.Sprintf("%v", s.config.Bootstrap),
},
"raft": s.raft.Stats(),
"serf-lan": map[string]string{
"members": toString(uint64(len(s.serfLAN.Members()))),
},
"serf-wan": map[string]string{
"members": toString(uint64(len(s.serfWAN.Members()))),
"datacenters": toString(uint64(len(s.remoteConsuls))),
"server": "true",
"leader": fmt.Sprintf("%v", s.IsLeader()),
"bootstrap": fmt.Sprintf("%v", s.config.Bootstrap),
"known_datacenters": toString(uint64(len(s.remoteConsuls))),
},
"raft": s.raft.Stats(),
"serf-lan": s.serfLAN.Stats(),
"serf-wan": s.serfWAN.Stats(),
}
return stats
}