private Instrument toInstrument(CacheStatisticsKey key, Supplier<Long> supplier) { switch (key.getType()) { case COUNTER: return counter(key, supplier); default: return gauge(key, supplier); } }
private ExternalCounter counter(CacheStatisticsKey key, Supplier<Long> supplier) { return new ExternalCounter(name + '.' + key.getLabel(), new StatisticValue(supplier)); }
private ExternalGauge gauge(CacheStatisticsKey key, Supplier<Long> supplier) { return new ExternalGauge(name + '.' + key.getLabel(), new StatisticValue(supplier)); }