consul: Add tags for consul protocol versions

This commit is contained in:
Armon Dadgar 2014-03-09 15:46:03 -07:00
parent 2a8d998968
commit cd6842ff6b
2 changed files with 9 additions and 3 deletions

View File

@ -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
}

View File

@ -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
}