tombentley commented on code in PR #12046:
URL: https://github.com/apache/kafka/pull/12046#discussion_r896689335


##########
clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java:
##########
@@ -506,9 +511,11 @@ static KafkaAdminClient createInternal(AdminClientConfig 
config, TimeoutProcesso
                 
.timeWindow(config.getLong(AdminClientConfig.METRICS_SAMPLE_WINDOW_MS_CONFIG), 
TimeUnit.MILLISECONDS)
                 
.recordLevel(Sensor.RecordingLevel.forName(config.getString(AdminClientConfig.METRICS_RECORDING_LEVEL_CONFIG)))
                 .tags(metricTags);
-            JmxReporter jmxReporter = new JmxReporter();
-            jmxReporter.configure(config.originals());
-            reporters.add(jmxReporter);
+            if 
(config.getBoolean(AdminClientConfig.AUTO_INCLUDE_JMX_REPORTER_CONFIG) && 
reporters.stream().noneMatch(r -> r instanceof JmxReporter)) {

Review Comment:
   `CommonClientConfigs` has a few helper methods on already (e.g. 
`postValidateSaslMechanismConfig`), so I wonder whether we should add a helper 
to encapsulate this condition too, wdyt?
   
   In fact I think we could encapsulate the whole creation of `listeners`, 
rather than just the condition for this `if` statement. Since there's no 
dependency between the `metricTags` + `metricConfig` and the `listeners`. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to