-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
admin: Add some missing admin methods #1178
Conversation
i renamed it to DescribeTopics, so it's consistent with its parameters and return value. |
@bai can you have a look? |
I'm just checking out Sarama for the first time, so not sure how closely you try to follow the Java reference clients. However, I added these same methods to
Java doesn't currently allow these overrides, but they were useful enough that we chose to include them in You can see how I then leveraged this when patching the Datadog check here: Note that I'm a total n00b to Go, so when I didn't find these overrides, it may be simply my misreading of the code and they may already be there... |
@bai Sorry for being annoying, but how could we move this forward? Or is this feature not desirable in sarama? |
admin.go
Outdated
ListConsumerGroups() (map[string]string, error) | ||
|
||
// Describe some group IDs in the cluster. | ||
DescribeConsumerGroup(group string) (*GroupDescription, error) |
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.
Can you please update the comment, it is not very clear here.
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.
done
admin.go
Outdated
@@ -380,3 +417,87 @@ func (ca *clusterAdmin) DeleteACL(filter AclFilter, validateOnly bool) ([]Matchi | |||
} | |||
return mAcls, nil | |||
} | |||
|
|||
func (ca *clusterAdmin) DescribeConsumerGroup(group string) (*GroupDescription, error) { |
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 wonder if it works better as DescribeConsumerGroups(groups []string)
, coz controller takes a slice of string anyway, and that way if you only want it for one group, you can only pass that 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.
i agree. i now improved it to accept a slice of group names. in addition, the logic is now quite smart to first build a map of brokers -> []string groups, so each group coordinator is contacted only once. in a trivial test / cluster with just 8 groups this saves me a second (50% savings)..which will have much a bigger impact on larger clusters.
wg.Add(1) | ||
go func(b *Broker, conf *Config) { | ||
defer wg.Done() | ||
_ = b.Open(conf) // Ensure that broker is opened |
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.
you can do
_ = b.Open(conf) // Ensure that broker is opened | |
b.Open(conf) // Ensure that broker is opened |
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 can, but then we don't document that there's an error (deliberately) ignored here.
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.
in fact errcheck will fail travis if i do what you suggest.. https://api.travis-ci.org/v3/job/490310704/log.txt i reverted that.
Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
@dnwe i added your commits of your PR #1155 ..since my work is based on that / related. since your PR is also pending and i require it as well, do you mind pushing this forward together? would be nice if we could get this finally merged :) it's becoming quite tedious to maintain my own fork for so long :( |
Ci failed with a strange error:
how can i trigger a re-run? |
DescribeCluster DescribeTopic DescribeConsumerGroups ListConsumerGroups ListConsumerGroupOffsets
Try closing and reopen again.
…Sent from my iPhone
On Feb 7, 2019, at 6:07 PM, Johannes Brüderl <notifications@github.com<mailto:notifications@github.com>> wrote:
Ci failed with a strange error:
# cd .; git clone https://go.googlesource.com/tools /home/travis/gopath/src/golang.org/x/tools<http://golang.org/x/tools>
Cloning into '/home/travis/gopath/src/golang.org/x/tools'<http://golang.org/x/tools'>...
fatal: remote error: Access denied to IP 35.188.1.99
package golang.org/x/tools/go/packages:<http://golang.org/x/tools/go/packages:> exit status 128
how can i trigger a re-run?
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub<#1178 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABOX5pJ-Iixx_tLtd1pN_jVGgewtp6WMks5vLL_HgaJpZM4W9n9p>.
|
great. it's green now :) |
Thanks! |
This is lovely work 💯 |
This PR adds the following admin client methods:
DescribeTopic
DescribeConsumerGroup
ListConsumerGroups
ListConsumerGroupOffsets
For ListConsumerGroups, all brokers are queried (the java client does it the same way). Since this will be super slow with multiple brokers, i made an implementation with parallel requests.
The others methods are rather straight forward.
I'll be happy about comments on the API, is it fine?
I'm not 100% sure - for the groups i chose it to be 'singular' - each method call is for one consumer group. For topics it's a slice of topics as parameter - in my case (building a kafka cli tool) it's very often the case that multiple topics are requested, so i kept it this way.
In #1155 (another addition to the admin client) i wondered how the API should look like. I kept it simple here. and reused types from the response messages.
I also added mock tests for these methods.