Package org.apache.ignite.internal.processors.metric.impl

## Class PeriodicHistogramMetricImpl

- java.lang.Object
- - org.apache.ignite.internal.processors.metric.AbstractMetric
  - - org.apache.ignite.internal.processors.metric.impl.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 Summary

Fields
`static int` `DFLT_BUCKETS_CNT` Default buckets count.
`static long` `DFLT_BUCKETS_INTERVAL` Default buckets interval in milliseconds.

### Constructor Summary

Constructors
`PeriodicHistogramMetricImpl​(long startTs, String name, @Nullable String desc)`
`PeriodicHistogramMetricImpl​(String name, @Nullable String desc)`

### Method Summary

All Methods Instance Methods Concrete Methods
`long[]` `bounds()`
`void` `bounds​(long[] bounds)` Sets bounds for this histogram.
`int` `bucketsCount()` Gets buckets count.
`long` `bucketsInterval()` Gets buckets interval.
`void` `decrement​(long ts)` Decrement count of items in interval by timestamp.
`IgniteBiTuple<long[],​long[]>` `histogram()` Gets histogram.
`void` `increment​(long ts)` Increment count of items in interval by timestamp.
`void` `reinit​(long bucketsInterval, int bucketsCnt)`
`void` `reset​(long itemsCnt)`
`long` `startTs()` Gets start timestamp.
`Class<long[]>` `type()`
`long[]` `value()`

### Methods inherited from class org.apache.ignite.internal.processors.metric.AbstractMetric

`description, equals, hashCode, name`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.ignite.spi.metric.Metric

`description, name, reset`

### Methods inherited from interface org.apache.ignite.spi.metric.ObjectMetric

`getAsString`

### 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.

#### bounds

    public void bounds​(long[] bounds)

Sets bounds for this histogram.

Specified by:
  `bounds` in interface `ConfigurableHistogramMetric`

#### 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.