From 6cf21fbbe90cec3f51dddc0c1bd7cd7bbb464cb1 Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Thu, 28 Apr 2016 15:08:48 -0700 Subject: [PATCH] Add the list of Raft peers to Consul's Stats ``` % consul info [snip] raft: [snip] raft_peers = 127.0.0.1:8300 [snip] ``` Poached from: Nomad Project --- consul/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/consul/server.go b/consul/server.go index 4d0005f088..865069f794 100644 --- a/consul/server.go +++ b/consul/server.go @@ -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 }