com.transferwise.common.baseutils.meters.cache.IMeterCache Maven / Gradle / Ivy
package com.transferwise.common.baseutils.meters.cache;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.DistributionSummary;
import io.micrometer.core.instrument.Meter;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Timer;
import java.util.function.Supplier;
public interface IMeterCache {
boolean contains(String name, TagsSet tags);
void clear();
int size();
Meter removeMeter(String name, TagsSet tags);
Object removeMetersContainer(String name, TagsSet tags);
/**
* Allows to also cache Objects, which contain multiple meters.
*
* Even when those can be cached by other means, it is convenient, that meterCache.clear() will also clear those.
*
* @deprecated in a favor of {@link #metersContainer(String, TagsSet, MeterContainerCreator)}.
*/
@Deprecated(forRemoval = true)
T metersContainer(String name, TagsSet tags, Supplier collectionCreator);
T metersContainer(String name, TagsSet tags, MeterContainerCreator meterContainerCreator);
DistributionSummary summary(String name, TagsSet tags);
/**
* Returns a DistributionSummary.
*
* @deprecated in a favor of {@link #summary(String, TagsSet, MeterCreator)} .
*/
@Deprecated(forRemoval = true)
DistributionSummary summary(String name, TagsSet tags, Supplier supplier);
DistributionSummary summary(String name, TagsSet tags, MeterCreator meterCreator);
Timer timer(String name, TagsSet tags);
/**
* Returns a counter.
*
* @deprecated in a favor of {@link #timer(String, TagsSet, MeterCreator)} .
*/
@Deprecated(forRemoval = true)
Timer timer(String name, TagsSet tags, Supplier supplier);
Timer timer(String name, TagsSet tags, MeterCreator meterCreator);
Counter counter(String name, TagsSet tags);
/**
* Returns a counter.
*
* @deprecated in a favor of {@link #counter(String, TagsSet, MeterCreator)} .
*/
@Deprecated(forRemoval = true)
Counter counter(String name, TagsSet tags, Supplier supplier);
Counter counter(String name, TagsSet tags, MeterCreator meterCreator);
MeterRegistry getMeterRegistry();
interface MeterCreator {
M create(String name, TagsSet tags);
}
interface MeterContainerCreator {
T create(String name, TagsSet tags);
}
}