see-quick commented on code in PR #20672:
URL: https://github.com/apache/kafka/pull/20672#discussion_r2465109091


##########
core/src/test/scala/unit/kafka/server/DynamicBrokerConfigTest.scala:
##########
@@ -1065,6 +1066,45 @@ class DynamicBrokerConfigTest {
     )
     
assertFalse(ctx.currentDefaultLogConfig.get().originals().containsKey(SocketServerConfigs.ADVERTISED_LISTENERS_CONFIG))
   }
+
+  @Test
+  def testClientTelemetryExporter(): Unit = {
+    val brokerId = 0
+    val origProps = TestUtils.createBrokerConfig(brokerId, port = 8181)
+    val config = KafkaConfig(origProps)
+    val metrics = mock(classOf[Metrics])
+    val telemetryPlugin = mock(classOf[ClientTelemetryExporterPlugin])
+
+    config.dynamicConfig.initialize(Some(telemetryPlugin))
+    val m = new DynamicMetricsReporters(brokerId, config, metrics, "clusterId")
+    config.dynamicConfig.addReconfigurable(m)
+
+    def updateReporter(reporterClass: Class[_]): Unit = {
+      val props = new Properties()
+      props.put(MetricConfigs.METRIC_REPORTER_CLASSES_CONFIG, 
reporterClass.getName)
+      config.dynamicConfig.updateDefaultConfig(props)
+    }
+
+    // Reporter implementing only ClientTelemetryExporterProvider
+    updateReporter(classOf[TestExporterOnly])

Review Comment:
   We agreed to go with a simpler approach of having those auxiliary classes. 
The issue in my previous setup was that I checked `atMostOnce()`, but that 
would also take into account zero calls, which was incorrect, so I have fixed 
that in the latest commit, where we check exactly once. 



-- 
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