Class StatisticRegistry
- java.lang.Object
-
- org.terracotta.statistics.registry.StatisticRegistry
-
public class StatisticRegistry extends Object
This class replaces the previousStatisticRegistryin the cases where you do not need any sampling and history.This class typically does a sort of mapping between the registrations and the discovered operations or passthrough statistics.
This class also support the generation of management metadata from the discovered statistics.
Non thread-safe.
- Author:
- Mathieu Carbou
-
-
Constructor Summary
Constructors Constructor Description StatisticRegistry(Object contextObject, LongSupplier timeSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,ValueStatistic<? extends Serializable>>getStatistics()<T extends Serializable>
Optional<Statistic<T>>queryStatistic(String fullStatisticName)Query a statistic based on the full statistic name.<T extends Serializable>
Optional<Statistic<T>>queryStatistic(String fullStatisticName, long sinceMillis)Query a statistic based on the full statistic name.Map<String,Statistic<? extends Serializable>>queryStatistics()Map<String,Statistic<? extends Serializable>>queryStatistics(long sinceMillis)voidregisterCounter(String fullStatName, Supplier<Number> accessor)Directly register a COUNTER stat with its accessorvoidregisterGauge(String fullStatName, Supplier<Number> accessor)Directly register a GAUGE stat with its accessor<T extends Enum<T>>
booleanregisterStatistic(String statNameSuffix, OperationStatisticDescriptor<T> descriptor, EnumSet<T> outcomes)<T extends Serializable>
booleanregisterStatistic(String statNameSuffix, ValueStatisticDescriptor descriptor)<T extends Serializable>
voidregisterStatistic(String fullStatName, StatisticType type, Supplier<T> accessor)<T extends Serializable>
voidregisterStatistic(String fullStatName, ValueStatistic<T> accessor)voidregisterTable(String fullStatName, Supplier<Table> accessor)Directly register a TABLE stat with its accessors
-
-
-
Constructor Detail
-
StatisticRegistry
public StatisticRegistry(Object contextObject, LongSupplier timeSource)
-
-
Method Detail
-
getStatistics
protected Map<String,ValueStatistic<? extends Serializable>> getStatistics()
-
queryStatistic
public <T extends Serializable> Optional<Statistic<T>> queryStatistic(String fullStatisticName)
Query a statistic based on the full statistic name. Returns null if not found.
-
queryStatistic
public <T extends Serializable> Optional<Statistic<T>> queryStatistic(String fullStatisticName, long sinceMillis)
Query a statistic based on the full statistic name. Returns null if not found.
-
queryStatistics
public Map<String,Statistic<? extends Serializable>> queryStatistics()
-
queryStatistics
public Map<String,Statistic<? extends Serializable>> queryStatistics(long sinceMillis)
-
registerStatistic
public <T extends Serializable> void registerStatistic(String fullStatName, StatisticType type, Supplier<T> accessor)
-
registerStatistic
public <T extends Serializable> void registerStatistic(String fullStatName, ValueStatistic<T> accessor)
-
registerTable
public void registerTable(String fullStatName, Supplier<Table> accessor)
Directly register a TABLE stat with its accessors
-
registerGauge
public void registerGauge(String fullStatName, Supplier<Number> accessor)
Directly register a GAUGE stat with its accessor
-
registerCounter
public void registerCounter(String fullStatName, Supplier<Number> accessor)
Directly register a COUNTER stat with its accessor
-
registerStatistic
public <T extends Serializable> boolean registerStatistic(String statNameSuffix, ValueStatisticDescriptor descriptor)
-
registerStatistic
public <T extends Enum<T>> boolean registerStatistic(String statNameSuffix, OperationStatisticDescriptor<T> descriptor, EnumSet<T> outcomes)
-
-