chia7712 commented on code in PR #21573:
URL: https://github.com/apache/kafka/pull/21573#discussion_r2867553866
##########
storage/src/main/java/org/apache/kafka/server/purgatory/DelayedRemoteListOffsets.java:
##########
@@ -191,4 +191,11 @@ private static void recordExpiration(TopicPartition
partition) {
TimeUnit.SECONDS,
mkMap(mkEntry("topic", tp.topic()), mkEntry("partition",
String.valueOf(tp.partition()))))).mark();
}
+
+ public static void removePartitionMetrics(TopicPartition partition) {
+ if (PARTITION_EXPIRATION_METERS.remove(partition) != null) {
+ METRICS_GROUP.removeMetric("ExpiresPerSec",
+ mkMap(mkEntry("topic", partition.topic()),
mkEntry("partition", String.valueOf(partition.partition()))));
Review Comment:
I'm not sure why we are still using `mkMap` and `mkEntry` now that we are
already on JDK 17. Would you mind filing a follow-up to clean these up?
##########
storage/src/test/java/org/apache/kafka/server/purgatory/DelayedRemoteListOffsetsTest.java:
##########
@@ -258,4 +265,56 @@ public void
testPartialResponseWhenNotLeaderOrFollowerExceptionOnOnePartition()
assertEquals(1, cancelledCount.get());
assertEquals(numResponse.get(), listOffsetsRequestKeys.size());
}
+
+ @Test
+ public void testRemovePartitionMetrics() {
Review Comment:
Should we call `TestUtils.clearYammerMetrics()` in the `after all` callback?
--
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]