showuon commented on code in PR #15133: URL: https://github.com/apache/kafka/pull/15133#discussion_r1461840656
########## core/src/test/scala/kafka/server/KafkaRequestHandlerTest.scala: ########## @@ -245,403 +251,438 @@ class KafkaRequestHandlerTest { @ParameterizedTest @ValueSource(booleans = Array(true, false)) def testSingularCopyLagBytesMetric(systemRemoteStorageEnabled: Boolean): Unit = { - val brokerTopicMetrics = setupBrokerTopicMetrics(systemRemoteStorageEnabled) + val props = kafka.utils.TestUtils.createDummyBrokerConfig() + props.setProperty(RemoteLogManagerConfig.REMOTE_LOG_STORAGE_SYSTEM_ENABLE_PROP, systemRemoteStorageEnabled.toString) + val brokerTopicStats = new BrokerTopicStats(java.util.Optional.of(KafkaConfig.fromProps(props))) + val brokerTopicMetrics = brokerTopicStats.topicStats(topic) if (systemRemoteStorageEnabled) { - brokerTopicMetrics.recordRemoteCopyLagBytes(0, 100); - brokerTopicMetrics.recordRemoteCopyLagBytes(1, 150); - brokerTopicMetrics.recordRemoteCopyLagBytes(2, 250); + brokerTopicStats.recordRemoteCopyLagBytes(topic, 0, 100) + brokerTopicStats.recordRemoteCopyLagBytes(topic, 1, 150) + brokerTopicStats.recordRemoteCopyLagBytes(topic, 2, 250) assertEquals(500, brokerTopicMetrics.remoteCopyLagBytes) + assertEquals(500, brokerTopicStats.allTopicsStats.remoteCopyLagBytes) + brokerTopicStats.recordRemoteCopyLagBytes(topic2, 0, 100) + assertEquals(600, brokerTopicStats.allTopicsStats.remoteCopyLagBytes) } else { assertEquals(None, brokerTopicMetrics.metricGaugeMap.get(RemoteStorageMetrics.REMOTE_COPY_LAG_BYTES_METRIC.getName)) + assertEquals(None, brokerTopicStats.allTopicsStats.metricGaugeMap.get(RemoteStorageMetrics.REMOTE_COPY_LAG_BYTES_METRIC.getName)) } Review Comment: Update the `KafkaRequestHandlerTest` to add allTopic metrics verification. -- 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