org.apache.ignite.internal.processors.metric

## Class MetricRegistry

- java.lang.Object
- - org.apache.ignite.internal.processors.metric.MetricRegistry

All Implemented Interfaces:
  Iterable<Metric>, ReadOnlyMetricRegistry

    public class MetricRegistry
    extends Object
    implements ReadOnlyMetricRegistry

Metric registry.

### Constructor Summary

Constructors
Constructor and Description
`MetricRegistry(String regName, Function<String,Long> hitRateCfgProvider, Function<String,long[]> histogramCfgProvider, IgniteLogger log)`

### Method Summary

All Methods Instance Methods Concrete Methods
`BooleanMetricImpl` `booleanMetric(String name, @Nullable String desc)` Creates and register named gauge.
`DoubleMetricImpl` `doubleMetric(String name, @Nullable String desc)` Creates and register named metric.
`<M extends Metric> M` `findMetric(String name)`
`HistogramMetricImpl` `histogram(String name, long[] bounds, @Nullable String desc)` Creates and registre named histogram gauge.
`HitRateMetric` `hitRateMetric(String name, @Nullable String desc, long rateTimeInterval, int size)` Creates and register hit rate metric.
`IntMetricImpl` `intMetric(String name, @Nullable String desc)` Creates and register named metric.
`@NotNull Iterator<Metric>` `iterator()`
`LongAdderMetric` `longAdderMetric(String name, LongConsumer delegate, @Nullable String desc)` Creates and register named metric.
`LongAdderMetric` `longAdderMetric(String name, @Nullable String desc)` Creates and register named metric.
`AtomicLongMetric` `longMetric(String name, @Nullable String desc)` Creates and register named metric.
`String` `name()`
`<T> ObjectMetricImpl<T>` `objectMetric(String name, Class<T> type, @Nullable String desc)` Creates and register named gauge.
`void` `register(Metric metric)` Register existing metrics in this group with the specified name.
`void` `register(String name, BooleanSupplier supplier, @Nullable String desc)` Registers `BooleanMetric` which value will be queried from the specified supplier.
`void` `register(String name, DoubleSupplier supplier, @Nullable String desc)` Registers `DoubleSupplier` which value will be queried from the specified supplier.
`void` `register(String name, IntSupplier supplier, @Nullable String desc)` Registers `IntMetric` which value will be queried from the specified supplier.
`LongGauge` `register(String name, LongSupplier supplier, @Nullable String desc)` Registers `LongGauge` which value will be queried from the specified supplier.
`<T> void` `register(String name, Supplier<T> supplier, Class<T> type, @Nullable String desc)` Registers `ObjectGauge` which value will be queried from the specified `Supplier`.
`void` `remove(String name)` Removes metrics with the `name`.
`void` `reset()` Resets state of this metric registry.

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

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

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Constructor Detail

#### MetricRegistry

    public MetricRegistry(String regName,
                          Function<String,Long> hitRateCfgProvider,
                          Function<String,long[]> histogramCfgProvider,
                          IgniteLogger log)

Parameters:
  `regName` - Registry name.
  `hitRateCfgProvider` - HitRate config provider.
  `histogramCfgProvider` - Histogram config provider.
  `log` - Logger.

### Method Detail

#### findMetric

    @Nullable
    public <M extends Metric> M findMetric(String name)

Specified by:
  `findMetric` in interface `ReadOnlyMetricRegistry`
Parameters:
  `name` - Name of the metric.
Returns:
  Metric with specified name if exists. Null otherwise.

#### reset

    public void reset()

Resets state of this metric registry.

#### objectMetric

    public <T> ObjectMetricImpl<T> objectMetric(String name,
                                                Class<T> type,
                                                @Nullable
                                                @Nullable String desc)

Creates and register named gauge. Returned instance are thread safe.

Parameters:
  `name` - Name.
  `type` - Type.
  `desc` - Description.
Returns:
  `ObjectMetricImpl`

#### iterator

    @NotNull
    public @NotNull Iterator<Metric> iterator()

Specified by:
  `iterator` in interface `Iterable<Metric>`

#### register

    public void register(Metric metric)

Register existing metrics in this group with the specified name.

Parameters:
  `metric` - Metric.

#### remove

    public void remove(String name)

Removes metrics with the `name`.

Parameters:
  `name` - Metric name.

#### register

    public void register(String name,
                         BooleanSupplier supplier,
                         @Nullable
                         @Nullable String desc)

Registers `BooleanMetric` which value will be queried from the specified supplier.

Parameters:
  `name` - Name.
  `supplier` - Supplier.
  `desc` - Description.

#### register

    public void register(String name,
                         DoubleSupplier supplier,
                         @Nullable
                         @Nullable String desc)

Registers `DoubleSupplier` which value will be queried from the specified supplier.

Parameters:
  `name` - Name.
  `supplier` - Supplier.
  `desc` - Description.

#### register

    public void register(String name,
                         IntSupplier supplier,
                         @Nullable
                         @Nullable String desc)

Registers `IntMetric` which value will be queried from the specified supplier.

Parameters:
  `name` - Name.
  `supplier` - Supplier.
  `desc` - Description.

#### register

    public LongGauge register(String name,
                              LongSupplier supplier,
                              @Nullable
                              @Nullable String desc)

Registers `LongGauge` which value will be queried from the specified supplier.

Parameters:
  `name` - Name.
  `supplier` - Supplier.
  `desc` - Description.
Returns:
  Metric of type `LongGauge`.

#### register

    public <T> void register(String name,
                             Supplier<T> supplier,
                             Class<T> type,
                             @Nullable
                             @Nullable String desc)

Registers `ObjectGauge` which value will be queried from the specified `Supplier`.

Parameters:
  `name` - Name.
  `supplier` - Supplier.
  `type` - Type.
  `desc` - Description.

#### doubleMetric

    public DoubleMetricImpl doubleMetric(String name,
                                         @Nullable
                                         @Nullable String desc)

Creates and register named metric. Returned instance are thread safe.

Parameters:
  `name` - Name.
  `desc` - Description.
Returns:
  `DoubleMetricImpl`.

#### intMetric

    public IntMetricImpl intMetric(String name,
                                   @Nullable
                                   @Nullable String desc)

Creates and register named metric. Returned instance are thread safe.

Parameters:
  `name` - Name.
  `desc` - Description.
Returns:
  `IntMetricImpl`.

#### longMetric

    public AtomicLongMetric longMetric(String name,
                                       @Nullable
                                       @Nullable String desc)

Creates and register named metric. Returned instance are thread safe.

Parameters:
  `name` - Name.
  `desc` - Description.
Returns:
  `AtomicLongMetric`.

#### longAdderMetric

    public LongAdderMetric longAdderMetric(String name,
                                           @Nullable
                                           @Nullable String desc)

Creates and register named metric. Returned instance are thread safe.

Parameters:
  `name` - Name.
  `desc` - Description.
Returns:
  `LongAdderMetric`.

#### longAdderMetric

    public LongAdderMetric longAdderMetric(String name,
                                           LongConsumer delegate,
                                           @Nullable
                                           @Nullable String desc)

Creates and register named metric. Returned instance are thread safe.

Parameters:
  `name` - Name.
  `delegate` - Delegate to which all updates from new metric will be delegated to.
  `desc` - Description.
Returns:
  `LongAdderWithDelegateMetric`.

#### hitRateMetric

    public HitRateMetric hitRateMetric(String name,
                                       @Nullable
                                       @Nullable String desc,
                                       long rateTimeInterval,
                                       int size)

Creates and register hit rate metric. It will accumulates approximate hit rate statistics. Calculates number of hits in last rateTimeInterval milliseconds.

Parameters:
  `rateTimeInterval` - Rate time interval.
  `size` - Array size for underlying calculations.
Returns:
  `HitRateMetric`
See Also:
  `HitRateMetric`

#### booleanMetric

    public BooleanMetricImpl booleanMetric(String name,
                                           @Nullable
                                           @Nullable String desc)

Creates and register named gauge. Returned instance are thread safe.

Parameters:
  `name` - Name.
  `desc` - Description.
Returns:
  `BooleanMetricImpl`

#### histogram

    public HistogramMetricImpl histogram(String name,
                                         long[] bounds,
                                         @Nullable
                                         @Nullable String desc)

Creates and registre named histogram gauge.

Parameters:
  `name` - Name
  `bounds` - Bounds of measurements.
  `desc` - Description.
Returns:
  `HistogramMetricImpl`

#### name

    public String name()

Specified by:
  `name` in interface `ReadOnlyMetricRegistry`
Returns:
  Registry name.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.0
Release Date | : February 27 2020