-
Notifications
You must be signed in to change notification settings - Fork 619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identify services using both the ID and the Node #414
Identify services using both the ID and the Node #414
Conversation
That looks simple enough. Can you update |
This aligns Fabio with the Consul docs[0] which state that a serviceID has to be unique per agent but not cluster wide. Fixes fabiolb#383 [0] https://www.consul.io/api/agent/service.html#id
aa84cc7
to
e41126e
Compare
Updated Thanks btw for your awesome work and really fast reaction on issues/PRs! |
I think in general |
// 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to align with what Consul servers internally do:
fmt.Sprintf("%s.%s", check.Node, check.ServiceID)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix that in a subsequent commit.
@dropje86 Does that actually result in Go not evaluating the other conditionals? @magiconair Is there still something missing from your POV? |
@alvaroaleman Although not clearly documented, Go does use "Short circuit evaluation". See here: https://kuree.gitbooks.io/the-go-programming-language-report/content/22/text.html |
Interesting, thanks for the link @dropje86! I've added a second commit that simplifies the conditional logic in |
Sorry, got a bit sick. I'll do this probably tomorrow and then try to run a release right away. Time to use goreleaser. |
@alvaroaleman Thanks for the patch. Merged it and made some small changes in subsequent commits. |
This aligns Fabio with the Consul docs[0] which state that
a serviceID has to be unique per agent but not cluster wide.
Fixes #383
[0] https://www.consul.io/api/agent/service.html#id