private static void maybePrintDataRows(String reportFormat, Map<ObjectName, Integer> numExpectedAttributes, List<String> keys, Map<String, Object> attributes) {
        if (attributes.size() == sumValues(numExpectedAttributes) + 1) {
            switch (reportFormat) {
                case "properties":
                    keys.forEach(key -> System.out.printf("%s=%s%n", key, attributes.get(key)));
                    break;
                case "csv":
                    keys.forEach(key -> System.out.printf("%s,\"%s\"%n", key, attributes.get(key)));
                    break;
                case "tsv":
                    keys.forEach(key -> System.out.printf("%s\t%s%n", key, attributes.get(key)));
                    break;
                default:
                    System.out.println(mkString(keys.stream().map(attributes::get), ","));
                    break;
            }
        }
    }
A program for reading JMX metrics from a given endpoint.
<p>
This tool only works reliably if the JmxServer is fully initialized prior to invoking the tool.
See KAFKA-4620 for details.
tools/src/main/java/org/apache/kafka/tools/JmxTool.java