private String addAttribute(KafkaMetric metric) {
        try {
            MetricName metricName = metric.metricName();
            String mBeanName = getMBeanName(prefix, metricName);
            if (!this.mbeans.containsKey(mBeanName))
                mbeans.put(mBeanName, new KafkaMbean(mBeanName));
            KafkaMbean mbean = this.mbeans.get(mBeanName);
            mbean.setAttribute(metricName.name(), metric);
            return mBeanName;
        } catch (JMException e) {
            throw new KafkaException("Error creating mbean attribute for metricName :" + metric.metricName(), e);
        }
    }
Create a JMX reporter that prefixes all metrics with the given string.
 @deprecated Since 2.6.0. Use {@link JmxReporter#JmxReporter()}
 Initialize JmxReporter with {@link JmxReporter#contextChange(MetricsContext)}
 Populate prefix by adding _namespace/prefix key value pair to {@link MetricsContext}
clients/src/main/java/org/apache/kafka/common/metrics/JmxReporter.java