You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "chia7712 (via GitHub)" <gi...@apache.org> on 2025/02/25 09:59:29 UTC

Re: [PR] KAFKA-17516: Synonyms for client metrics configs [kafka]

chia7712 commented on code in PR #17264:
URL: https://github.com/apache/kafka/pull/17264#discussion_r1969426571


##########
core/src/test/scala/integration/kafka/api/PlaintextAdminIntegrationTest.scala:
##########
@@ -981,10 +981,6 @@ class PlaintextAdminIntegrationTest extends BaseAdminIntegrationTest {
     val groupResource = new ConfigResource(ConfigResource.Type.GROUP, "none_group")
     val groupResult = client.describeConfigs(Seq(groupResource).asJava).all().get().get(groupResource)
     assertNotEquals(0, groupResult.entries().size())
-
-    val metricResource = new ConfigResource(ConfigResource.Type.CLIENT_METRICS, "none_metric")
-    val metricResult = client.describeConfigs(Seq(metricResource).asJava).all().get().get(metricResource)
-    assertEquals(0, metricResult.entries().size())

Review Comment:
   Pardon me, is there a patch or ticket?



##########
core/src/main/scala/kafka/server/ConfigHelper.scala:
##########
@@ -210,6 +201,28 @@ class ConfigHelper(metadataCache: MetadataCache, config: KafkaConfig, configRepo
       .setDocumentation(configDocumentation).setConfigType(dataType.id)
   }
 
+  private def createClientMetricsConfigEntry(clientMetricsConfig: ClientMetricsConfigs, clientMetricsProps: Properties, includeSynonyms: Boolean, includeDocumentation: Boolean)
+                                            (name: String, value: Any): DescribeConfigsResponseData.DescribeConfigsResourceResult = {
+    val configEntryType = ClientMetricsConfigs.configType(name).asScala
+    val valueAsString = ConfigDef.convertToString(value, configEntryType.orNull)
+    val allSynonyms = {
+      if (!clientMetricsProps.containsKey(name)) {
+        Nil

Review Comment:
   It seems we rarely use `Nil` in code base. Maybe we can use `List` instead?
   ```scala
       val allSynonyms = if (!clientMetricsProps.containsKey(name)) List.empty else 
           List(new DescribeConfigsResponseData.DescribeConfigsSynonym().setName(name).setValue(valueAsString)
             .setSource(ConfigSource.CLIENT_METRICS_CONFIG.id))
   ```



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org