-
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
ability to filter topic's config options when listing topics #1815
Conversation
I'm not sure about introducing a new exported func for this specialisation of the behaviour. From the code it seems that the intention was never to return default or sensitive values in the response, so I would probably suggest that we correct that and just announce it in the changelog as a "potentially breaking change" for people to be aware of. I think we'd still be in the spirit of semver as the API remained stable. If we wanted to, we could introduce a new ListTopicsWithOptions that just takes a simple struct of bools to change the behavior As an aside |
thanks for the feedback @dnwe The reason that I'm not too keen to change the current behaviour of I also thought about having only some bools to returns some data, like you mentioned And as you mention, it looks like this has diverged now too much from the java AdminClient, so, not sure we'd need to follow their way of passing options, that looks is limited. |
As mentioned though — the code clearly never intended to include Default values in the response https://github.com/Shopify/sarama/blob/65f0fec86aabe011db77ad641d31fddf14f3ca41/admin.go#L371-L375 so personally I think it would be fine to correct the behaviour to match that intention, as long we mention as such in the changelog
Well ListTopics in Sarama is essentially just a convenience wrapper around a MetadataRequest and a bulk DescribeConfigsRequest, with a slice of ConfigResource for all the topics, which are all things a user can technically call themselves. We currently have an exported func for the DescribeConfig in admin.go — although it would have been better if it was a variadic function (something to change in 2.x maybe?) so it could take a slice of ConfigResources rather than only taking a single one like it does: However, if it was only the broker-provided default config for topics that we start omitting in the ListTopics response, those would be accessible with a single DescribeConfig with a ConfigResource for broker config. |
@dnwe hey Dominic, tl;dr: Sarama is ok, this PR is not needed. I made the wrong assumption here:
the issue was that I used |
related to #1514
Sarama
ListTopics
returns by default config options that are not default, however, it also returns brokers static configs, the java command line tool only returns by defaults the dynamic topic config options, however it also have the option to return all the configuration. This PR tries to offer an option to allow to get the required topic's configuration options.This PR allows to use a new function
ListTopicsAndFilterConfigEntries
(please some help with the naming), which allows to pass a different filter, so we can get whatever combination that we'd like:a few examples:
all options:
kafka-configs.sh --bootstrap-server localhost:9092 --entity-type topics --entity-name xxxtopic --describe -all
only sensitive:
what java returs by default:
kafka-configs.sh --bootstrap-server localhost:9092 --entity-type topics --entity-name xxxtopic --describe
I didn't want to modify the current expectation of
ListTopics
as some people might be depending on current resultsping @sladkoff as I see you worked on #1594