Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-7734

Metrics tags should use LinkedHashMap to guarantee ordering

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0, 2.1.1
    • Component/s: metrics
    • Labels:
      None

      Description

      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

      kafka.streams:type=stream-record-cache-metrics,client-id=([-.\w]+),task-id=([-.\w]+),record-cache-id=([-.\w]+)
      

      However, what I've seen from JMXReporter is, for example:

      kafka.streams:type=stream-record-cache-metrics,record-cache-id=all,client-id=streams-saak-test-client-StreamThread-1,task-id=1_3
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lambdaliu lambdaliu
                Reporter:
                guozhang Guozhang Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: