Guozhang Wang created KAFKA-7734: ------------------------------------ Summary: Metrics tags should use LinkedHashMap to guarantee ordering Key: KAFKA-7734 URL: https://issues.apache.org/jira/browse/KAFKA-7734 Project: Kafka Issue Type: Improvement Components: metrics Reporter: Guozhang Wang
Today we store metrics tags inside MetricName from various places, and many of them are using `HashMap`. However, for metrics reporters like JMXReporter, the mBeanName is constructed by looping over `metricName.tags().entrySet()` which does not guarantee ordering. This resulted a few places where the mBeanName string not as expected, e.g. we document the Streams cache metrics as {code} kafka.streams:type=stream-record-cache-metrics,client-id=([-.\w]+),task-id=([-.\w]+),record-cache-id=([-.\w]+) {code} However, what I've seen from JMXReporter is, for example: {code} kafka.streams:type=stream-record-cache-metrics,record-cache-id=all,client-id=streams-saak-test-client-StreamThread-1,task-id=1_3 {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)