Class StatisticDefinition<T extends StatisticSupplier>

java.lang.Object
com.pervasive.datarush.monitoring.StatisticDefinition<T>
Type Parameters:
T - the type of StatisticSupplier 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:
  • Field Details

  • Method Details

    • 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 that IntervalTimerDefinition's always aggregate:
      1. The min start time is calculated across all partitions
      2. The max stop time (or current time if timer is still running)is calculated across all partitions
      3. 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 be StatisticState.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 provider
      operation - 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 provider
      operation - 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 its id()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object o)
      Two StatisticDefinition's are considered equal iff their ids are equal.
      Overrides:
      equals in class Object
      Returns:
      other is a StatisticDefinition of the same name as this.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 the StatisticSupplier 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 type T
    • 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 type T
    • 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 type T