kamalcph commented on code in PR #14832: URL: https://github.com/apache/kafka/pull/14832#discussion_r1420085913
########## core/src/main/scala/kafka/server/KafkaRequestHandler.scala: ########## @@ -386,7 +431,26 @@ class BrokerTopicMetrics(name: Option[String], configOpt: java.util.Optional[Kaf meter.close() } - def close(): Unit = metricTypeMap.values.foreach(_.close()) + def close(): Unit = { + metricTypeMap.values.foreach(_.close()) + metricGaugeTypeMap.values.foreach(_.close()) + } +} + +class BrokerTopicAggregatedMetric() { + private val partitionMetricValues = new ConcurrentHashMap[Int, Long]().asScala + + def setPartitionMetricValue(partition: Int, partitionValue: Long): Option[Long] = { + partitionMetricValues.put(partition, partitionValue) + } + + def removePartition(partition: Int): Option[Long] = { + partitionMetricValues.remove(partition) + } + + def value(): Long = partitionMetricValues.values.sum Review Comment: Also, instead of computing the aggregated `value` on each reporting (typically: 10 s). Can we keep one variable `value` and update it while recording the partition level metrics? -- 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