[ 
https://issues.apache.org/jira/browse/KAFKA-6320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300894#comment-16300894
 ] 

ASF GitHub Bot commented on KAFKA-6320:
---------------------------------------

junrao commented on a change in pull request #4351: KAFKA-6320: move ZK metrics 
in KafkaHealthCheck to ZookeeperClient
URL: https://github.com/apache/kafka/pull/4351#discussion_r158420549
 
 

 ##########
 File path: core/src/test/scala/integration/kafka/api/MetricsTest.scala
 ##########
 @@ -205,15 +205,13 @@ class MetricsTest extends IntegrationTestHarness with 
SaslSetup {
   }
 
   private def verifyBrokerZkMetrics(server: KafkaServer, topic: String): Unit 
= {
-    // Latency is rounded to milliseconds, so we may need to retry some 
operations to get latency > 0.
-    val (_, recorded) = TestUtils.computeUntilTrue({
-      servers.head.zkClient.getLeaderForPartition(new TopicPartition(topic, 0))
-      
yammerMetricValue("kafka.server:type=ZooKeeperClientMetrics,name=ZooKeeperRequestLatencyMs").asInstanceOf[Double]
-    })(latency => latency > 0.0)
-    assertTrue("ZooKeeper latency not recorded", recorded)
-
-    assertEquals(s"Unexpected ZK state 
${server.zkUtils.zkConnection.getZookeeperState}",
-        "CONNECTED", yammerMetricValue("SessionState"))
+    // Latency is rounded to milliseconds, so check the count instead.
+    val initialCount = 
yammerHistogramCount("kafka.server:type=ZooKeeperClientMetrics,name=ZooKeeperRequestLatencyMs").asInstanceOf[Long]
 
 Review comment:
   Right, since the ZK write in between is blocking and is guaranteed to update 
the count in the histogram. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> move ZK metrics in KafkaHealthCheck to ZookeeperClient
> ------------------------------------------------------
>
>                 Key: KAFKA-6320
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6320
>             Project: Kafka
>          Issue Type: Sub-task
>    Affects Versions: 1.0.0
>            Reporter: Jun Rao
>            Assignee: Jun Rao
>             Fix For: 1.1.0
>
>
> In KAFKA-5473, we will be de-commissioning the usage of KafkaHealthCheck. So, 
> we need to move the ZK metrics SessionState and ZooKeeper${eventType}PerSec 
> in that class to somewhere else (e.g. ZookeeperClient).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to