mimaison commented on code in PR #19050: URL: https://github.com/apache/kafka/pull/19050#discussion_r2041168550
########## clients/src/main/java/org/apache/kafka/common/internals/Plugin.java: ########## @@ -40,14 +47,46 @@ private Plugin(T instance, PluginMetricsImpl pluginMetrics) { this.pluginMetrics = Optional.ofNullable(pluginMetrics); } + /** + * Wrap an instance into a Plugin. + * @param instance the instance to wrap + * @param metrics the metrics + * @param tagsSupplier supplier to retrieve the tags + * @return the plugin + */ + public static <T> Plugin<T> wrapInstance(T instance, Metrics metrics, Supplier<Map<String, String>> tagsSupplier) { + PluginMetricsImpl pluginMetrics = null; + if (instance instanceof Monitorable && metrics != null) { + pluginMetrics = new PluginMetricsImpl(metrics, tagsSupplier.get()); + ((Monitorable) instance).withPluginMetrics(pluginMetrics); + } + return new Plugin<>(instance, pluginMetrics); + } Review Comment: Feel free to open a jira if you want to handle this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org