This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new b0e5cdfc572 KAFKA-18777 add `PartitionsWithLateTransactionsCount` to
BrokerMetricNamesTest (#18869)
b0e5cdfc572 is described below
commit b0e5cdfc5723f890dd88b1398a4e22de9e876745
Author: Jhen-Yung Hsu <[email protected]>
AuthorDate: Wed Feb 12 22:09:42 2025 +0800
KAFKA-18777 add `PartitionsWithLateTransactionsCount` to
BrokerMetricNamesTest (#18869)
Rewrite BrokerMetricNamesTest using ReplicaManager.MetricNames, ensuring
that all metrics are always included. This helps prevent issues like
PartitionsWithLateTransactionsCount not being correctly included in the test
before.
Reviewers: Chia-Ping Tsai <[email protected]>
---
core/src/test/scala/unit/kafka/server/BrokerMetricNamesTest.scala | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/core/src/test/scala/unit/kafka/server/BrokerMetricNamesTest.scala
b/core/src/test/scala/unit/kafka/server/BrokerMetricNamesTest.scala
index 4f48dedbf9c..300bc2d8d42 100644
--- a/core/src/test/scala/unit/kafka/server/BrokerMetricNamesTest.scala
+++ b/core/src/test/scala/unit/kafka/server/BrokerMetricNamesTest.scala
@@ -40,12 +40,7 @@ class BrokerMetricNamesTest(cluster: ClusterInstance) {
def checkReplicaManagerMetrics(): Unit = {
val metrics = KafkaYammerMetrics.defaultRegistry.allMetrics
val expectedPrefix = "kafka.server:type=ReplicaManager,name"
- val expectedMetricNames = Set(
- "LeaderCount", "PartitionCount", "OfflineReplicaCount",
"UnderReplicatedPartitions",
- "UnderMinIsrPartitionCount", "AtMinIsrPartitionCount",
"ReassigningPartitions",
- "IsrExpandsPerSec", "IsrShrinksPerSec", "FailedIsrUpdatesPerSec",
- "ProducerIdCount",
- )
+ val expectedMetricNames = ReplicaManager.MetricNames
expectedMetricNames.foreach { metricName =>
assertEquals(1, metrics.keySet.asScala.count(_.getMBeanName ==
s"$expectedPrefix=$metricName"))
}