Randall Hauch created KAFKA-5987:
------------------------------------
Summary: Kafka metrics templates used in document generation
should maintain order of tags
Key: KAFKA-5987
URL: https://issues.apache.org/jira/browse/KAFKA-5987
Project: Kafka
Issue Type: Improvement
Components: clients
Affects Versions: 1.0.0
Reporter: Randall Hauch
Assignee: Randall Hauch
Fix For: 1.0.0
KAFKA-5191 recently added a new {{MetricNameTemplate}} that is used to create
the {{MetricName}} objects in the producer and consumer, as we as in the
newly-added generation of metric documentation. The {{MetricNameTemplate}} and
the {{Metric.toHtmlTable}} do not maintain the order of the tags, which means
the resulting HTML documentation will order the table of MBean attributes based
upon the lexicographical ordering of the MBeans, each of which uses the
lexicographical ordering of its tags. This can result in the following order:
{noformat}
kafka.connect:type=sink-task-metrics,connector={connector},partition={partition},task={task},topic={topic}
kafka.connect:type=sink-task-metrics,connector={connector},task={task}
{noformat}
However, if the MBeans maintained the order of the tags then the documentation
would use the following order:
{noformat}
kafka.connect:type=sink-task-metrics,connector={connector},task={task}
kafka.connect:type=sink-task-metrics,connector={connector},task={task},topic={topic},partition={partition}
{noformat}
This would be more readable, and the code that is creating the templates would
have control over the order of the tags.
To maintain order, {{MetricNameTemplate}} should used a {{LinkedHashSet}} for
the tags, and the {{Metrics.toHtmlTable}} method should also use a
{{LinkedHashMap}} when building up the tags used in the MBean name.
Note that JMX MBean names use {{ObjectName}} that does not maintain order, so
this change should have no impact on JMX MBean names.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)