-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
KAFKA-18894: Add KIP-877 support for ConfigProvider #19397
base: trunk
Are you sure you want to change the base?
Conversation
Thanks for this patch, please use |
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.
Thanks @Yunyung for this patch, left some comments
* returns a map of config provider name and its instance wrapped in a {@link org.apache.kafka.common.internals.Plugin}. | ||
* | ||
* @param indirectConfigs The map of potential variable configs | ||
* @param providerConfigProperties The map of config provider configs | ||
* @param classNameFilter Filter for config provider class names | ||
* @return map of config provider name and its instance. | ||
* @return map of config provider name and its instance wrapped in a {@link org.apache.kafka.common.internals.Plugin}. |
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.
We could keep the original document, FYI #19050 (comment)
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.
Sure. I'll update all of them later.
for (Map.Entry<String, String> entry : providerMap.entrySet()) { | ||
try { | ||
String prefix = CONFIG_PROVIDERS_CONFIG + "." + entry.getKey() + CONFIG_PROVIDERS_PARAM; | ||
Map<String, ?> configProperties = configProviderProperties(prefix, providerConfigProperties); | ||
ConfigProvider provider = Utils.newInstance(entry.getValue(), ConfigProvider.class); | ||
provider.configure(configProperties); | ||
configProviderInstances.put(entry.getKey(), provider); | ||
Plugin<ConfigProvider> providerPlugin = Plugin.wrapInstance(provider, null, CONFIG_PROVIDERS_CONFIG); |
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 don't think we need to wrap provider
into a Plugin
at this point, since the metrics are null
and it doesn't seem to serve any practical purpose.
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.
This change is for ConfigTransformer#transform, so we need to update the path where the transform method is used.
CONFIG_PROVIDERS_CONFIG + "." + name, | ||
Plugins.ClassLoaderUsage.PLUGINS | ||
name, | ||
Plugins.ClassLoaderUsage.PLUGINS, | ||
null |
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.
ditto: I don't think we need to wrap provider
into a Plugin
at this point, since the metrics are null
and it doesn't seem to serve any practical purpose.
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.
Ditto.
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.
Thanks for the review! PTAL again.
for (Map.Entry<String, String> entry : providerMap.entrySet()) { | ||
try { | ||
String prefix = CONFIG_PROVIDERS_CONFIG + "." + entry.getKey() + CONFIG_PROVIDERS_PARAM; | ||
Map<String, ?> configProperties = configProviderProperties(prefix, providerConfigProperties); | ||
ConfigProvider provider = Utils.newInstance(entry.getValue(), ConfigProvider.class); | ||
provider.configure(configProperties); | ||
configProviderInstances.put(entry.getKey(), provider); | ||
Plugin<ConfigProvider> providerPlugin = Plugin.wrapInstance(provider, null, CONFIG_PROVIDERS_CONFIG); |
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.
This change is for ConfigTransformer#transform, so we need to update the path where the transform method is used.
CONFIG_PROVIDERS_CONFIG + "." + name, | ||
Plugins.ClassLoaderUsage.PLUGINS | ||
name, | ||
Plugins.ClassLoaderUsage.PLUGINS, | ||
null |
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.
Ditto.
* returns a map of config provider name and its instance wrapped in a {@link org.apache.kafka.common.internals.Plugin}. | ||
* | ||
* @param indirectConfigs The map of potential variable configs | ||
* @param providerConfigProperties The map of config provider configs | ||
* @param classNameFilter Filter for config provider class names | ||
* @return map of config provider name and its instance. | ||
* @return map of config provider name and its instance wrapped in a {@link org.apache.kafka.common.internals.Plugin}. |
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.
Sure. I'll update all of them later.
Add KIP-877 support for ConfigProvider.
Cleanup: Collections.singletonMap() -> Map.of()
Jira: https://issues.apache.org/jira/browse/KAFKA-18894