Module datarush.commons
Class StatisticDefinition<T extends StatisticSupplier>
- java.lang.Object
-
- com.pervasive.datarush.monitoring.StatisticDefinition<T>
-
- Type Parameters:
T
- the type ofStatisticSupplier
associated 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 String
CATEGORY_GENERAL
The name of the default categorystatic String
CATEGORY_IO
The 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 T
aggregate(List<? extends StatisticSupplier> values)
Performs aggregation across statistics.abstract T
cast(StatisticSupplier value)
Casts theStatisticSupplier
to this definition, substituting a default value for null.String
category()
Returns a category for this statistic type.abstract StatisticDefinition<T>
category(String category)
Sets the categorystatic CounterDefinition
cpuTime()
A statistic that provides the cpu time in milliseconds.String
displayName()
Returns a display name for this statistic type.static IntervalTimerDefinition
duration()
A statistic that provides the total time that an operation has been running.boolean
equals(Object o)
TwoStatisticDefinition
's are considered equal iff their ids are equal.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.int
hashCode()
Returns a hashCode for this definition based on itsid()
String
id()
Returns a unique identifier for this statistic type.static CounterDefinition
ioBytes(String provider, IOChannelOperation operation)
A statistic that provides the number of io bytes.static CounterDefinition
ioCount(String provider, IOChannelOperation operation)
A statistic that provides the number of io operations.boolean
nonPartitioned()
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.String
toString()
-
-
-
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.FINISHED
when 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:
equals
in classObject
- Returns:
- other is a
StatisticDefinition
of 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 theStatisticSupplier
to 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
-
-