Skip to content

Commit

Permalink
use node.serviceID as naming scheme for services
Browse files Browse the repository at this point in the history
Consul uses "node.serviceID" as the internal agent specific name
for a service instance. Although it doesn't really matter in this
case we'll align the naming to that scheme.
  • Loading branch information
magiconair committed Dec 21, 2017
1 parent 8b9a885 commit a7751a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions registry/consul/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func servicesConfig(client *api.Client, checks []*api.HealthCheck, tagPrefix str
// Make the node part of the id, because according to the Consul docs
// the ServiceID is unique per agent but not cluster wide
// https://www.consul.io/api/agent/service.html#id
name, id := check.ServiceName, check.ServiceID+check.Node
name, id := check.ServiceName, fmt.Sprintf("%s.%s", check.Node, check.ServiceID)

if _, ok := m[name]; !ok {
m[name] = map[string]bool{}
Expand Down Expand Up @@ -88,7 +88,7 @@ func serviceConfig(client *api.Client, name string, passing map[string]bool, tag
for _, svc := range svcs {
// check if the instance is in the list of instances
// which passed the health check
if _, ok := passing[svc.ServiceID+svc.Node]; !ok {
if _, ok := passing[fmt.Sprintf("%s.%s", svc.Node, svc.ServiceID)]; !ok {
continue
}

Expand Down

0 comments on commit a7751a4

Please sign in to comment.