@Override
    public void close() {
        registry.ifPresent(r -> Arrays.asList(
            LATEST_SNAPSHOT_GENERATED_BYTES,
            LATEST_SNAPSHOT_GENERATED_AGE_MS
        ).forEach(r::removeMetric));
    }
Create a new LoaderMetrics object.

@param registry  The metrics registry, or Optional.empty if this is a test and we don't have one.
metadata/src/main/java/org/apache/kafka/image/publisher/metrics/SnapshotEmitterMetrics.java