-
Notifications
You must be signed in to change notification settings - Fork 83
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
Added filtering abilities into Agent.Services #128
Added filtering abilities into Agent.Services #128
Conversation
@@ -37,8 +37,12 @@ internal static string GenerateTestKeyName() | |||
|
|||
for (var i = 0; i < keyChars.Length; i++) | |||
{ | |||
keyChars[i] = Convert.ToChar(Random.Next(65, 91)); | |||
lock (Random) |
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.
Random
class is not thread-safe, we need to make sure only one thread uses it at a time.
{ | ||
return _client.Get<Dictionary<string, AgentService>>("/v1/agent/services").Execute(ct); | ||
return await Services(null, ct); |
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.
It is better to use await
even for simple pass-through invocations like this one. When the call is not awaited then it will be not visible on the call stack (if there is an exception being thrown within that call).
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.
Does this change break the API or ABI compatibility?
To be clear, I'm not arguing against it at all, I just wonder what it might mean in terms of semantic versioning.
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.
No, it is not affecting nether API nor ABI compatibility.
The 'aysnc' keyword doesn't change the "signature" of a method (note that the IAgentEndpoint
doesn't use async keywords).
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.
👍 looks good to me
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.
LGTM too 👍
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.
Looks OK.
Looking at the consul API, we should probably list the remaining tasks for full coverage of various Consul APIs. For example, for filtering, there is an extra parameter for enterprise Consul users (do we have any support policy for the Enterprise version of Consul btw?!) https://www.consul.io/api-docs/agent/service#parameters
Likewise, our selectors could support more keys https://www.consul.io/api-docs/agent/service#filtering. Just a few remarks on follow-up work, this is good to merge.
Fixes #33
Documentation:https://www.consul.io/api-docs/agent/service#filtering