static MetricValue convert(UntypedMetric val) {
        if (val.isCounter()) {
            return CountMetric.newInstance(val.getCount());
        } else {
            if (val.getHistogram() == null) {
                return GaugeMetric.newInstance(val.getLast(), val.getMax(), val.getMin(), val.getSum(), val.getCount());
            } else {
                return GaugeMetric.newInstance(val.getLast(), val.getMax(), val.getMin(), val.getSum(), val.getCount(),
                        Optional.of(buildPercentileList(val.getHistogram())));
            }
        }
    }
Convert simple metrics snapshots into jdisc state snapshots.

@author arnej27959
container-core/src/main/java/com/yahoo/metrics/simple/jdisc/SnapshotConverter.java