FrankYang0529 commented on code in PR #16752:
URL: https://github.com/apache/kafka/pull/16752#discussion_r1698725995


##########
storage/src/main/java/org/apache/kafka/storage/internals/log/LogSegment.java:
##########
@@ -72,14 +71,7 @@ public class LogSegment implements Closeable {
     private static final Pattern FUTURE_DIR_PATTERN = 
Pattern.compile("^(\\S+)-(\\S+)\\.(\\S+)" + FUTURE_DIR_SUFFIX);
 
     static {
-        KafkaMetricsGroup logFlushStatsMetricsGroup = new 
KafkaMetricsGroup(LogSegment.class) {
-            @Override
-            public MetricName metricName(String name, Map<String, String> 
tags) {
-                // Override the group and type names for compatibility - this 
metrics group was previously defined within
-                // a Scala object named `kafka.log.LogFlushStats`
-                return KafkaMetricsGroup.explicitMetricName("kafka.log", 
"LogFlushStats", name, tags);
-            }
-        };
+        KafkaMetricsGroup logFlushStatsMetricsGroup = new 
KafkaMetricsGroup(LogSegment.class);

Review Comment:
   It looks like original code would like to use `LogFlushStats` class in 
`kafka.log` package. If we use `LogSegment.class`, the behavior is different 
from original one.



##########
core/src/main/scala/kafka/log/UnifiedLog.scala:
##########
@@ -111,12 +110,7 @@ class UnifiedLog(@volatile var logStartOffset: Long,
 
   import kafka.log.UnifiedLog._
 
-  private val metricsGroup = new KafkaMetricsGroup(this.getClass) {
-    // For compatibility, metrics are defined to be under `Log` class
-    override def metricName(name: String, tags: util.Map[String, String]): 
MetricName = {
-      KafkaMetricsGroup.explicitMetricName(getClass.getPackage.getName, "Log", 
name, tags)
-    }
-  }
+  private val metricsGroup = new KafkaMetricsGroup(this.getClass)

Review Comment:
   ditto



##########
core/src/main/scala/kafka/server/KafkaBroker.scala:
##########
@@ -103,13 +100,7 @@ trait KafkaBroker extends Logging {
   def clientToControllerChannelManager: NodeToControllerChannelManager
   def tokenCache: DelegationTokenCache
 
-  private val metricsGroup = new KafkaMetricsGroup(this.getClass) {
-    // For backwards compatibility, we need to keep older metrics tied
-    // to their original name when this class was named `KafkaServer`
-    override def metricName(name: String, tags: util.Map[String, String]): 
MetricName = {
-      KafkaMetricsGroup.explicitMetricName(Server.MetricsPrefix, 
KafkaBroker.MetricsTypeName, name, tags)
-    }
-  }
+  private val metricsGroup = new KafkaMetricsGroup(this.getClass)

Review Comment:
   ditto



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

Reply via email to