From 6cb519fe8247343fb991a1bd629300d1ff29161f Mon Sep 17 00:00:00 2001 From: Sharif Nassar <snassar@bottlenose.com> Date: Thu, 20 Aug 2015 10:35:38 -0700 Subject: [PATCH] Add Consul ServiceID to the discovery meta labels. --- AUTHORS.md | 1 + retrieval/discovery/consul.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/AUTHORS.md b/AUTHORS.md index eae5395a9b..5b1fdac2f7 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -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> diff --git a/retrieval/discovery/consul.go b/retrieval/discovery/consul.go index df44af7e47..945e23db4d 100644 --- a/retrieval/discovery/consul.go +++ b/retrieval/discovery/consul.go @@ -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), }) }