Top Description Fields Constructors Methods
org.terracotta.statistics.registry

public Class StatisticRegistry

extends Object
Class Inheritance
Imports
org.terracotta.context.ContextManager, .TreeNode, org.terracotta.context.query.Matcher, .Matchers, org.terracotta.statistics.OperationStatistic, .StatisticType, .Table, .ValueStatistic, java.io.Serializable, java.util.Collection, .Collections, .EnumSet, .HashMap, .Map, .Objects, .Optional, .Set, java.util.function.LongSupplier, .Supplier, java.util.stream.Collectors

This class replaces the previous StatisticRegistry in 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

Field Summary

Modifier and TypeField and Description
private final Object
private final Map<String, ValueStatistic<? extends Serializable>>
private final LongSupplier

Constructor Summary

AccessConstructor and Description
public
StatisticRegistry(Object contextObject, LongSupplier timeSource)

Method Summary

Modifier and TypeMethod and Description
protected Map<String, ValueStatistic<? extends Serializable>>
private Matcher<Map<String, Object>>
hasTags(final Collection<String> tags)

public <T extends Serializable> Optional<Statistic<T>>
queryStatistic(String fullStatisticName)

Query a statistic based on the full statistic name.

public <T extends Serializable> Optional<Statistic<T>>
queryStatistic(String fullStatisticName, long sinceMillis)

Query a statistic based on the full statistic name.

public Map<String, Statistic<? extends Serializable>>
public Map<String, Statistic<? extends Serializable>>
queryStatistics(long sinceMillis)

public void
registerCounter(String fullStatName, Supplier<Number> accessor)

Directly register a COUNTER stat with its accessor

public void
registerGauge(String fullStatName, Supplier<Number> accessor)

Directly register a GAUGE stat with its accessor

public <T extends Serializable> void
registerStatistic(String fullStatName, StatisticType type, Supplier<T> accessor)

public <T extends Serializable> void
registerStatistic(String fullStatName, ValueStatistic<T> accessor)

public <T extends Serializable> boolean
public <T extends Enum<T>> boolean
registerStatistic(String statNameSuffix, final OperationStatisticDescriptor<T> descriptor, final EnumSet<T> outcomes)

public void
registerTable(String fullStatName, Supplier<Table> accessor)

Directly register a TABLE stat with its accessors

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextObjectback to summary
private final Object contextObject
statisticsback to summary
private final Map<String, ValueStatistic<? extends Serializable>> statistics
timeSourceback to summary
private final LongSupplier timeSource

Constructor Detail

StatisticRegistryback to summary
public StatisticRegistry(Object contextObject, LongSupplier timeSource)

Method Detail

getStatisticsback to summary
protected Map<String, ValueStatistic<? extends Serializable>> getStatistics()
hasTagsback to summary
private Matcher<Map<String, Object>> hasTags(final Collection<String> tags)
queryStatisticback to summary
public <T extends Serializable> Optional<Statistic<T>> queryStatistic(String fullStatisticName)

Query a statistic based on the full statistic name. Returns null if not found.

queryStatisticback to summary
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.

Annotations
@SuppressWarnings:unchecked
queryStatisticsback to summary
public Map<String, Statistic<? extends Serializable>> queryStatistics()
queryStatisticsback to summary
public Map<String, Statistic<? extends Serializable>> queryStatistics(long sinceMillis)
Annotations
@SuppressWarnings:unchecked
registerCounterback to summary
public void registerCounter(String fullStatName, Supplier<Number> accessor)

Directly register a COUNTER stat with its accessor

registerGaugeback to summary
public void registerGauge(String fullStatName, Supplier<Number> accessor)

Directly register a GAUGE stat with its accessor

registerStatisticback to summary
public <T extends Serializable> void registerStatistic(String fullStatName, StatisticType type, Supplier<T> accessor)
registerStatisticback to summary
public <T extends Serializable> void registerStatistic(String fullStatName, ValueStatistic<T> accessor)
registerStatisticback to summary
public <T extends Serializable> boolean registerStatistic(String statNameSuffix, ValueStatisticDescriptor descriptor)
Annotations
@SuppressWarnings:unchecked
registerStatisticback to summary
public <T extends Enum<T>> boolean registerStatistic(String statNameSuffix, final OperationStatisticDescriptor<T> descriptor, final EnumSet<T> outcomes)
Annotations
@SuppressWarnings:unchecked
registerTableback to summary
public void registerTable(String fullStatName, Supplier<Table> accessor)

Directly register a TABLE stat with its accessors