public static MetricName explicitMetricName(String group, String typeName,
                                                String name, Map<String, String> tags) {
        StringBuilder nameBuilder = new StringBuilder(100);
        nameBuilder.append(group);
        nameBuilder.append(":type=");
        nameBuilder.append(typeName);

        if (!name.isEmpty()) {
            nameBuilder.append(",name=");
            nameBuilder.append(name);
        }

        String scope = toScope(tags).orElse(null);
        Optional<String> tagsName = toMBeanName(tags);
        tagsName.ifPresent(s -> nameBuilder.append(",").append(s));

        return new MetricName(group, typeName, name, scope, nameBuilder.toString());
    }
Creates a new MetricName object for gauges, meters, etc. created for this
metrics group.
@param name Descriptive name of the metric.
@param tags Additional attributes which mBean will have.
@return Sanitized metric name object.
server-common/src/main/java/org/apache/kafka/server/metrics/KafkaMetricsGroup.java