abhijeetk88 commented on code in PR #13944: URL: https://github.com/apache/kafka/pull/13944#discussion_r1257264233
########## core/src/test/java/kafka/log/remote/RemoteLogReaderTest.java: ########## @@ -61,15 +74,20 @@ public void testRemoteLogReaderWithoutError() throws RemoteStorageException, IOE assertFalse(actualRemoteLogReadResult.error.isPresent()); assertTrue(actualRemoteLogReadResult.fetchDataInfo.isPresent()); assertEquals(fetchDataInfo, actualRemoteLogReadResult.fetchDataInfo.get()); + + // Verify metrics for remote reads are updated correctly + assertEquals(1, brokerTopicStats.topicStats(TOPIC).remoteReadRequestRate().count()); + assertEquals(100, brokerTopicStats.topicStats(TOPIC).remoteBytesInRate().count()); + assertEquals(0, brokerTopicStats.topicStats(TOPIC).failedRemoteReadRequestRate().count()); } @Test public void testRemoteLogReaderWithError() throws RemoteStorageException, IOException { - when(mockRLM.read(any(RemoteStorageFetchInfo.class))).thenThrow(new OffsetOutOfRangeException("error")); + when(mockRLM.read(any(RemoteStorageFetchInfo.class))).thenThrow(new RuntimeException("error")); Review Comment: We do not capture the failed remote request metric in the case of OffsetOutOfRangeException. I could add another test where it throws a non-OffsetOutOfRangeException keeping this test as is, but this test does nothing specific to OffsetOutOfRangeException (only requires an unsuccessful read), hence I decided to change the exception type and verify the metrics in this test itself. -- 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