Merge pull request #1019 from mrwacky42/add-consul-service-id

Add Consul ServiceID to the discovery meta labels.
pull/1021/head
Brian Brazil 9 years ago
commit 725a507206

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

@ -47,6 +47,8 @@ const (
ConsulServicePortLabel = clientmodel.MetaLabelPrefix + "consul_service_port" ConsulServicePortLabel = clientmodel.MetaLabelPrefix + "consul_service_port"
// ConsulDCLabel is the name of the label containing the datacenter ID. // ConsulDCLabel is the name of the label containing the datacenter ID.
ConsulDCLabel = clientmodel.MetaLabelPrefix + "consul_dc" 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 // 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), ConsulTagsLabel: clientmodel.LabelValue(tags),
ConsulServiceAddressLabel: clientmodel.LabelValue(node.ServiceAddress), ConsulServiceAddressLabel: clientmodel.LabelValue(node.ServiceAddress),
ConsulServicePortLabel: clientmodel.LabelValue(strconv.Itoa(node.ServicePort)), ConsulServicePortLabel: clientmodel.LabelValue(strconv.Itoa(node.ServicePort)),
ConsulServiceIDLabel: clientmodel.LabelValue(node.ServiceID),
}) })
} }

Loading…
Cancel
Save