private Instant instantAdded(MetricKey metricKey) {
            // lookup when the metric was added to use it as the interval start. That should always
            // exist, but if it doesn't (e.g. changed metrics temporality) then we use now.
            return metricAdded.computeIfAbsent(metricKey, x -> Instant.ofEpochMilli(time.milliseconds()));
        }
Keeps track of the state of metrics, e.g. when they were added, what their getAndSet value is,
and clearing them out when they're removed.
clients/src/main/java/org/apache/kafka/common/telemetry/internals/KafkaMetricsCollector.java