junrao commented on code in PR #15251:
URL: https://github.com/apache/kafka/pull/15251#discussion_r1465492172
##########
server/src/test/java/org/apache/kafka/server/ClientMetricsManagerTest.java:
##########
@@ -1023,5 +1177,18 @@ public void
testCacheExpirationTaskCancelledOnInstanceUpdate() throws UnknownHos
assertNotNull(instance);
assertNotNull(instance.expirationTimerTask());
assertEquals(1, clientMetricsManager.expirationTimer().size());
+ // Metrics size should remain same on instance update.
+ assertEquals(12, kafkaMetrics.metrics().size());
+ assertEquals((double) 1,
getMetric(ClientMetricsManager.ClientMetricsStats.INSTANCE_COUNT).metricValue());
+ }
+
+ private KafkaMetric getMetric(String name) throws Exception {
+ Optional<Entry<MetricName, KafkaMetric>> metric =
kafkaMetrics.metrics().entrySet().stream()
Review Comment:
Hmm, why do we need to iterate the whole map instead of doing a `get` based
on name on the map?
--
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]