From 79501dc745a0341c6c62b75a7ca80edf9a91907e Mon Sep 17 00:00:00 2001 From: "Joseph (Ting-Chou) Lin" Date: Tue, 25 Apr 2023 14:22:44 -0700 Subject: [PATCH] [LI-FIXUP] Enhance metrics tag for `BrokerToControllerRequestManager`s (#454) This should be a direct fix-up to the commit - e37eaa0 [LI-HOTFIX] Add observability into AlterIsrManager (#453) EXIT_CRITERIA = When the corresponding commit is dropped Using this tag, the `kafka-server` can generate inGraph metrics for both `DefaultAlterIsrManager` and `TransferLeaderManager` (or even future broker-to-controller channel) together with one regex query ``` "kafka.server:type=*,name=*,requestManagerCategory=BrokerToControllerRequestManager" ``` --- .../scala/kafka/server/BrokerToControllerRequestManager.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/scala/kafka/server/BrokerToControllerRequestManager.scala b/core/src/main/scala/kafka/server/BrokerToControllerRequestManager.scala index 9910ce24ccba5..ae9bff3d11304 100644 --- a/core/src/main/scala/kafka/server/BrokerToControllerRequestManager.scala +++ b/core/src/main/scala/kafka/server/BrokerToControllerRequestManager.scala @@ -65,7 +65,7 @@ abstract class AbstractBrokerToControllerRequestManager[Item <: BrokerToControll private val inflightRequest: AtomicBoolean = new AtomicBoolean(false) // Additional observability into the internal states - private val baseMetricTags = Map("class" -> getClass.getName) + private val baseMetricTags = Map("requestManagerCategory" -> BrokerToControllerRequestManager.getClass.getSimpleName.replaceAll("\\$$", "")) @volatile private var lastInflightRequestLockTimeMs = time.milliseconds() @VisibleForTesting private[server] val unsentItemQueueSizeGauge = newGauge("unsentItemQueueSize", () => unsentItemQueue.size, baseMetricTags) @VisibleForTesting private[server] val inflightRequestGauge = newGauge("inflightRequest", () => if (inflightRequest.get()) 1 else 0, baseMetricTags)