Edoardo Comar created KAFKA-20453:
-------------------------------------

             Summary: Metrics of group "kafka.network.SocketServer" should have 
tags unique to each SocketServer
                 Key: KAFKA-20453
                 URL: https://issues.apache.org/jira/browse/KAFKA-20453
             Project: Kafka
          Issue Type: Bug
          Components: metrics, unit tests
            Reporter: Edoardo Comar


kafka.network.SocketServer scala creates metrics which have no tags to 
distinguish them from those of another SocketServer 

e.g. for MemoryPool
{color:#871094}metricsGroup{color}.newGauge({color:#067d17}"MemoryPoolAvailable"{color},
 () => {color:#871094}memoryPool{color}.availableMemory)

This is a problem found in ClusterTests - which run in a single JVM and have a 
singleton KafkaYammerRegistry. So there is a single gauge even though there are 
multiple MemoryPools.

The test created for https://issues.apache.org/jira/browse/KAFKA-20302
could not use the metric to access the memory pool available memory.

Outside tests, when kafka is running in Combined KRaft mode there are 2 socket 
servers per node. So the metric value is the one of the socket server who gers 
created first (the controller, where arguably the memory pool is less useful).

A partial fix would be to add a nodeId tag - this would help just ClusterTests 
in KRAFT mode but this would still not work for CO-KRAFT mode where we need to 
find a way to distinguish the multiple socket servers per process. 

Given that co-kraft is not for production modes, perhaps a simple counter of 
SocketServer instances could suffice.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to