From cd6842ff6b750ca0967320c24c8aaa625885cd03 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Sun, 9 Mar 2014 15:46:03 -0700 Subject: [PATCH] consul: Add tags for consul protocol versions --- consul/client.go | 5 ++++- consul/server.go | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/consul/client.go b/consul/client.go index 9412e1e205..b0ca744882 100644 --- a/consul/client.go +++ b/consul/client.go @@ -110,6 +110,9 @@ func (c *Client) setupSerf(conf *serf.Config, ch chan serf.Event, path string) ( conf.NodeName = c.config.NodeName conf.Tags["role"] = "node" conf.Tags["dc"] = c.config.Datacenter + conf.Tags["vsn"] = fmt.Sprintf("%d", c.config.ProtocolVersion) + conf.Tags["vsn_min"] = fmt.Sprintf("%d", ProtocolVersionMin) + conf.Tags["vsn_max"] = fmt.Sprintf("%d", ProtocolVersionMax) conf.MemberlistConfig.LogOutput = c.config.LogOutput conf.LogOutput = c.config.LogOutput conf.EventCh = ch @@ -326,7 +329,7 @@ func (c *Client) Stats() map[string]map[string]string { "server": "false", "known_servers": toString(uint64(len(c.consuls))), }, - "serf-lan": c.serf.Stats(), + "serf_lan": c.serf.Stats(), } return stats } diff --git a/consul/server.go b/consul/server.go index 654a319fcd..323bcbf5e1 100644 --- a/consul/server.go +++ b/consul/server.go @@ -180,6 +180,9 @@ func (s *Server) setupSerf(conf *serf.Config, ch chan serf.Event, path string) ( conf.NodeName = s.config.NodeName conf.Tags["role"] = "consul" conf.Tags["dc"] = s.config.Datacenter + conf.Tags["vsn"] = fmt.Sprintf("%d", s.config.ProtocolVersion) + conf.Tags["vsn_min"] = fmt.Sprintf("%d", ProtocolVersionMin) + conf.Tags["vsn_max"] = fmt.Sprintf("%d", ProtocolVersionMax) conf.Tags["port"] = fmt.Sprintf("%d", addr.Port) if s.config.Bootstrap { conf.Tags["bootstrap"] = "1" @@ -482,8 +485,8 @@ func (s *Server) Stats() map[string]map[string]string { "known_datacenters": toString(uint64(len(s.remoteConsuls))), }, "raft": s.raft.Stats(), - "serf-lan": s.serfLAN.Stats(), - "serf-wan": s.serfWAN.Stats(), + "serf_lan": s.serfLAN.Stats(), + "serf_wan": s.serfWAN.Stats(), } return stats }