Jason Gustafson created KAFKA-13789:
---------------------------------------

             Summary: Fragile tag ordering in metric mbean names
                 Key: KAFKA-13789
                 URL: https://issues.apache.org/jira/browse/KAFKA-13789
             Project: Kafka
          Issue Type: Improvement
            Reporter: Jason Gustafson


We noticed that mbean name creation logic is a bit fragile in 
`KafkaMetricsGroup`, which many server components rely on. We rely on the 
ordering of tags in the underlying map collection. Any change to the map 
implementation could result in a different tag ordering, which would result in 
a different mbean name.

In [https://github.com/apache/kafka/pull/11970,] we reimplemented the metric 
naming function to rely on LinkedHashMap so that the ordering is explicit. We 
should try to upgrade current metrics to rely on the new method, which probably 
will involve ensuring that we have good test coverage for registered metrics. 
At a minimum, we should ensure new metrics use the explicit ordering. Perhaps 
we can consider deprecating the old methods or creating a new 
`SafeKafkaMetricsGroup` implementation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to