private Object metricLock() {
        return metricLock;
    }
KafkaMetrics of sensors which use SampledStat should be synchronized on the same lock
for sensor record and metric value read to allow concurrent reads and updates. For simplicity,
all sensors are synchronized on this object.
<p>
Sensor object is not used as a lock for reading metric value since metrics reporter is
invoked while holding Sensor and Metrics locks to report addition and removal of metrics
and synchronized reporters may deadlock if Sensor lock is used for reading metrics values.
Note that Sensor object itself is used as a lock to protect the access to stats and metrics
while recording metric values, adding and deleting sensors.
</p><p>
Locking order (assume all MetricsReporter methods may be synchronized):
<ul>
  <li>Sensor#add: Sensor -> Metrics -> MetricsReporter</li>
  <li>Metrics#removeSensor: Sensor -> Metrics -> MetricsReporter</li>
  <li>KafkaMetric#metricValue: MetricsReporter -> Sensor#metricLock</li>
  <li>Sensor#record: Sensor -> Sensor#metricLock</li>
</ul>
</p>
clients/src/main/java/org/apache/kafka/common/metrics/Sensor.java