Module datarush.commons
Class StatisticDefinition<T extends StatisticSupplier>
- java.lang.Object
-
- com.pervasive.datarush.monitoring.StatisticDefinition<T>
-
- Type Parameters:
T- the type ofStatisticSupplierassociated with this statistic.
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AccumulatedTimerDefinition,CounterDefinition,GaugeDefinition,IntervalTimerDefinition
public abstract class StatisticDefinition<T extends StatisticSupplier> extends Object implements Serializable
Provides metadata for a statistic including including display name controls how the statistic is to be aggregated across partitions.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringCATEGORY_GENERALThe name of the default categorystatic StringCATEGORY_IOThe name of the category for I/O related statistics
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Taggregate(List<? extends StatisticSupplier> values)Performs aggregation across statistics.abstract Tcast(StatisticSupplier value)Casts theStatisticSupplierto this definition, substituting a default value for null.Stringcategory()Returns a category for this statistic type.abstract StatisticDefinition<T>category(String category)Sets the categorystatic CounterDefinitioncpuTime()A statistic that provides the cpu time in milliseconds.StringdisplayName()Returns a display name for this statistic type.static IntervalTimerDefinitionduration()A statistic that provides the total time that an operation has been running.booleanequals(Object o)TwoStatisticDefinition's are considered equal iff their ids are equal.TfinalSnapshot(StatisticSupplier supplier)Returns a snapshot view of the given statistics with all statistics appropriate for a graph that is in a terminated state.inthashCode()Returns a hashCode for this definition based on itsid()Stringid()Returns a unique identifier for this statistic type.static CounterDefinitionioBytes(String provider, IOChannelOperation operation)A statistic that provides the number of io bytes.static CounterDefinitionioCount(String provider, IOChannelOperation operation)A statistic that provides the number of io operations.booleannonPartitioned()Indicates that this statistic refers to a concept that is inherently non-parallel.abstract StatisticDefinition<T>nonPartitioned(boolean nonPartitioned)Indicates that this statistic refers to a concept that is inherently non-parallel.StringtoString()
-
-
-
Field Detail
-
CATEGORY_GENERAL
public static final String CATEGORY_GENERAL
The name of the default category- See Also:
- Constant Field Values
-
CATEGORY_IO
public static final String CATEGORY_IO
The name of the category for I/O related statistics- See Also:
- Constant Field Values
-
-
Method Detail
-
duration
public static IntervalTimerDefinition duration()
A statistic that provides the total time that an operation has been running. This statistic aggregates in the same way thatIntervalTimerDefinition's always aggregate:- The min start time is calculated across all partitions
- The max stop time (or current time if timer is still running)is calculated across all partitions
- The interval is calculated by subtracting min start time from max stop time
- Returns:
- total time duration
-
cpuTime
public static CounterDefinition cpuTime()
A statistic that provides the cpu time in milliseconds. The counter will beStatisticState.FINISHEDwhen the operator finishes execution. This statistic aggregates horizontally by summation. This statistic aggregates vertically (within a composite) by summation as well.- Returns:
- cpuTime in milliSeconds
-
ioBytes
public static CounterDefinition ioBytes(String provider, IOChannelOperation operation)
A statistic that provides the number of io bytes. This statistic is broken down by filesystem provider type.- Parameters:
provider- the filesystem provideroperation- the read/write operation- Returns:
- the definition
-
ioCount
public static CounterDefinition ioCount(String provider, IOChannelOperation operation)
A statistic that provides the number of io operations. This statistic is broken down by filesystem provider type.- Parameters:
provider- the filesystem provideroperation- the read/write operation- Returns:
- the definition
-
id
public final String id()
Returns a unique identifier for this statistic type.- Returns:
- a unique identifier for this statistic type.
-
displayName
public final String displayName()
Returns a display name for this statistic type.- Returns:
- a display for this statistic type.
-
category
public final String category()
Returns a category for this statistic type.- Returns:
- a category for this statistic type.
-
nonPartitioned
public final boolean nonPartitioned()
Indicates that this statistic refers to a concept that is inherently non-parallel. An example would be planning statistics.- Returns:
- whether this statistic refers to a non-partitioned concept
-
hashCode
public final int hashCode()
Returns a hashCode for this definition based on itsid()
-
equals
public final boolean equals(Object o)
TwoStatisticDefinition's are considered equal iff their ids are equal.- Overrides:
equalsin classObject- Returns:
- other is a
StatisticDefinitionof the same name as this.
-
category
public abstract StatisticDefinition<T> category(String category)
Sets the category- Parameters:
category- the category- Returns:
- a newly-created
StatisticDefinition.
-
nonPartitioned
public abstract StatisticDefinition<T> nonPartitioned(boolean nonPartitioned)
Indicates that this statistic refers to a concept that is inherently non-parallel. An example would be planning statistics.- Parameters:
nonPartitioned- whether this statistic refers to a non-partitioned concept- Returns:
- a newly-created
StatisticDefinition.
-
cast
public abstract T cast(StatisticSupplier value)
Casts theStatisticSupplierto this definition, substituting a default value for null.- Parameters:
value- the value- Returns:
- a casted value or default if null.
- Throws:
ClassCastException- if the supplier is not of typeT
-
finalSnapshot
public final T finalSnapshot(StatisticSupplier supplier)
Returns a snapshot view of the given statistics with all statistics appropriate for a graph that is in a terminated state.- Parameters:
supplier- the original statistic- Returns:
- a snapshot view of the original statistic
- Throws:
ClassCastException- if the supplier is not of typeT
-
aggregate
public abstract T aggregate(List<? extends StatisticSupplier> values)
Performs aggregation across statistics. Statistics will be aggregated in a manner specific to the concrete definition.- Parameters:
values- the values to aggregate- Returns:
- the aggregated value
- Throws:
ClassCastException- if any of the values are not of typeT
-
-