From 6cb519fe8247343fb991a1bd629300d1ff29161f Mon Sep 17 00:00:00 2001 From: Sharif Nassar 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 eae5395a9..5b1fdac2f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -41,6 +41,7 @@ The following individuals have contributed code to this repository * Sam McLeod * Scott Worley * Sergiusz 'q3k' BazaƄski +* Sharif Nassar * Sindre Myren * Stephan Erb * Stephen Shirley diff --git a/retrieval/discovery/consul.go b/retrieval/discovery/consul.go index df44af7e4..945e23db4 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), }) }