Package org.terracotta.statistics
Class GeneralOperationStatistic<T extends java.lang.Enum<T>>
- java.lang.Object
-
- org.terracotta.statistics.AbstractSourceStatistic<ChainedOperationObserver<? super T>>
-
- org.terracotta.statistics.AbstractOperationStatistic<T>
-
- org.terracotta.statistics.GeneralOperationStatistic<T>
-
- Type Parameters:
T- the operation result enum type
- All Implemented Interfaces:
OperationObserver<T>,OperationStatistic<T>,SourceStatistic<ChainedOperationObserver<? super T>>
class GeneralOperationStatistic<T extends java.lang.Enum<T>> extends AbstractOperationStatistic<T> implements OperationStatistic<T>
An operation observer that tracks operation result counts and can drive further derived statistics.AbstractOperationStatistic.begin()andend(Enum)must be called from the same thread so that latency can be computed.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.LongAdder[]counts-
Fields inherited from class org.terracotta.statistics.AbstractOperationStatistic
name, properties, tags, type
-
Fields inherited from class org.terracotta.statistics.AbstractSourceStatistic
derivedStatistics
-
-
Constructor Summary
Constructors Constructor Description GeneralOperationStatistic(java.lang.String name, java.util.Set<java.lang.String> tags, java.util.Map<java.lang.String,? extends java.lang.Object> properties, java.lang.Class<T> type)Create an operation statistics for a given operation result type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcount(T type)Return the count of operations with the given type.voidend(T result)Called immediately after the operation completes with no interesting parameters, and with the same thread the called {OperationObserver.begin()} before.longsum(java.util.Set<T> types)java.lang.StringtoString()-
Methods inherited from class org.terracotta.statistics.AbstractOperationStatistic
begin, sum, type
-
Methods inherited from class org.terracotta.statistics.AbstractSourceStatistic
addDerivedStatistic, getDerivedStatistics, removeDerivedStatistic
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.terracotta.statistics.observer.OperationObserver
begin
-
Methods inherited from interface org.terracotta.statistics.OperationStatistic
statistic, statistic, sum, type
-
Methods inherited from interface org.terracotta.statistics.SourceStatistic
addDerivedStatistic, getDerivedStatistics, removeDerivedStatistic
-
-
-
-
Constructor Detail
-
GeneralOperationStatistic
GeneralOperationStatistic(java.lang.String name, java.util.Set<java.lang.String> tags, java.util.Map<java.lang.String,? extends java.lang.Object> properties, java.lang.Class<T> type)Create an operation statistics for a given operation result type.- Parameters:
properties- a set of context propertiestype- operation result type
-
-
Method Detail
-
count
public long count(T type)
Return the count of operations with the given type.- Specified by:
countin interfaceOperationStatistic<T extends java.lang.Enum<T>>- Parameters:
type- the result type- Returns:
- the operation count
-
sum
public long sum(java.util.Set<T> types)
- Specified by:
sumin interfaceOperationStatistic<T extends java.lang.Enum<T>>
-
end
public void end(T result)
Description copied from interface:OperationObserverCalled immediately after the operation completes with no interesting parameters, and with the same thread the called {OperationObserver.begin()} before.- Specified by:
endin interfaceOperationObserver<T extends java.lang.Enum<T>>- Overrides:
endin classAbstractOperationStatistic<T extends java.lang.Enum<T>>- Parameters:
result- the operation result
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-