Add Consul ServiceID to the discovery meta labels.

This commit is contained in:
Sharif Nassar 2015-08-20 10:35:38 -07:00
parent ac0be60bb9
commit 6cb519fe82
2 changed files with 4 additions and 0 deletions

View File

@ -41,6 +41,7 @@ The following individuals have contributed code to this repository
* Sam McLeod <sammcj@users.noreply.github.com>
* Scott Worley <scottworley@scottworley.com>
* Sergiusz 'q3k' Bazański <q3k@q3k.org>
* Sharif Nassar <mrwacky42@gmail.com>
* Sindre Myren <smyrman@gmail.com>
* Stephan Erb <github@stephanerb.eu>
* Stephen Shirley <kormat@gmail.com>

View File

@ -47,6 +47,8 @@ const (
ConsulServicePortLabel = clientmodel.MetaLabelPrefix + "consul_service_port"
// ConsulDCLabel is the name of the label containing the datacenter ID.
ConsulDCLabel = clientmodel.MetaLabelPrefix + "consul_dc"
// ConsulServiceIDLabel is the name of the label containing the service ID.
ConsulServiceIDLabel = clientmodel.MetaLabelPrefix + "consul_service_id"
)
// ConsulDiscovery retrieves target information from a Consul server
@ -276,6 +278,7 @@ func (cd *ConsulDiscovery) watchService(srv *consulService, ch chan<- *config.Ta
ConsulTagsLabel: clientmodel.LabelValue(tags),
ConsulServiceAddressLabel: clientmodel.LabelValue(node.ServiceAddress),
ConsulServicePortLabel: clientmodel.LabelValue(strconv.Itoa(node.ServicePort)),
ConsulServiceIDLabel: clientmodel.LabelValue(node.ServiceID),
})
}