Merge pull request #2001 from hashicorp/f-consul-info-peers

Add the list of Raft peers to Consul's Stats
This commit is contained in:
James Phillips 2016-04-28 15:12:55 -07:00
commit 235a577385
1 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import (
"path/filepath"
"reflect"
"strconv"
"strings"
"sync"
"time"
@ -743,6 +744,11 @@ func (s *Server) Stats() map[string]map[string]string {
"serf_wan": s.serfWAN.Stats(),
"runtime": runtimeStats(),
}
if peers, err := s.raftPeers.Peers(); err == nil {
stats["raft"]["raft_peers"] = strings.Join(peers, ",")
} else {
s.logger.Printf("[DEBUG] server: error getting raft peers: %v", err)
}
return stats
}