public void addMetric(MetricName metricName, MetricConfig config, MetricValueProvider<?> metricValueProvider) {
        KafkaMetric m = new KafkaMetric(new Object(),
                                        Objects.requireNonNull(metricName),
                                        Objects.requireNonNull(metricValueProvider),
                                        config == null ? this.config : config,
                                        time);
        KafkaMetric existingMetric = registerMetric(m);
        if (existingMetric != null) {
            throw new IllegalArgumentException("A metric named '" + metricName + "' already exists, can't register another one.");
        }
    }
Add a metric to monitor an object that implements MetricValueProvider. This metric won't be associated with any
sensor. This is a way to expose existing values as metrics. User is expected to add any additional
synchronization to update and access metric values, if required.

@param metricName The name of the metric
@param metricValueProvider The metric value provider associated with this metric
@throws IllegalArgumentException if a metric with same name already exists.
clients/src/main/java/org/apache/kafka/common/metrics/Metrics.java