Class PeriodicHistogramMetricImpl

  • All Implemented Interfaces:
    ConfigurableHistogramMetric, HistogramMetric, Metric, ObjectMetric<long[]>

    public class PeriodicHistogramMetricImpl
    extends AbstractMetric
    implements ConfigurableHistogramMetric
    Histogram to show count of items for each time interval with limited set of intervals. Count of items in interval can be incremented or decremented by timestamp. Items with timestamp below the first interval are moved into "out of bounds interval". Over time new intervals are added and old intervals are merged into "out of bounds interval" to maintain the same total count of intervals.
    • Field Detail

      • DFLT_BUCKETS_INTERVAL

        public static final long DFLT_BUCKETS_INTERVAL
        Default buckets interval in milliseconds.
        See Also:
        Constant Field Values
      • DFLT_BUCKETS_CNT

        public static final int DFLT_BUCKETS_CNT
        Default buckets count.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PeriodicHistogramMetricImpl

        public PeriodicHistogramMetricImpl​(String name,
                                           @Nullable
                                           @Nullable String desc)
        Parameters:
        name - Metric name.
        desc - Metric description.
      • PeriodicHistogramMetricImpl

        public PeriodicHistogramMetricImpl​(long startTs,
                                           String name,
                                           @Nullable
                                           @Nullable String desc)
        Parameters:
        startTs - Starting point.
        name - Metric name.
        desc - Metric description.
    • Method Detail

      • bounds

        public long[] bounds()
        Specified by:
        bounds in interface HistogramMetric
        Returns:
        Bounds of this histogram.
      • value

        public long[] value()
        Specified by:
        value in interface ObjectMetric<long[]>
        Returns:
        Value ot the metric.
      • type

        public Class<long[]> type()
        Specified by:
        type in interface ObjectMetric<long[]>
        Returns:
        Type of metric value.
      • reinit

        public void reinit​(long bucketsInterval,
                           int bucketsCnt)
        Parameters:
        bucketsInterval - Buckets interval.
        bucketsCnt - Buckets count.
      • reset

        public void reset​(long itemsCnt)
        Parameters:
        itemsCnt - Total items count.
      • increment

        public void increment​(long ts)
        Increment count of items in interval by timestamp.
      • decrement

        public void decrement​(long ts)
        Decrement count of items in interval by timestamp.
      • histogram

        public IgniteBiTuple<long[],​long[]> histogram()
        Gets histogram.
        Returns:
        Tuple, where first item is array of bounds and second item is array of values. Bounds and values are guaranteed to be consistent.
      • bucketsInterval

        public long bucketsInterval()
        Gets buckets interval.
      • bucketsCount

        public int bucketsCount()
        Gets buckets count.
      • startTs

        public long startTs()
        Gets start timestamp.