org.apache.ignite.internal.processors.metric

## Class GridMetricManager

- java.lang.Object
- - org.apache.ignite.internal.managers.GridManagerAdapter<MetricExporterSpi>
  - - org.apache.ignite.internal.processors.metric.GridMetricManager

All Implemented Interfaces:
  Iterable<ReadOnlyMetricRegistry>, GridComponent, GridManager, ReadOnlyMetricManager

    public class GridMetricManager
    extends GridManagerAdapter<MetricExporterSpi>
    implements ReadOnlyMetricManager

This manager should provide `ReadOnlyMetricManager` for each configured `MetricExporterSpi`.

See Also:
  `MetricExporterSpi`, `MetricRegistry`

### Nested Class Summary

Nested Classes
`class` `GridMetricManager.MemoryUsageMetrics` Memory usage metrics.

### Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent

`GridComponent.DiscoveryDataExchangeType`

### Field Summary

Fields
`static String` `ACTIVE_COUNT_DESC`
`static String` `CLUSTER_METRICS` Cluster metrics prefix.
`static String` `COMPLETED_TASK_DESC`
`static String` `CORE_SIZE_DESC`
`static String` `CPU_LOAD` CPU load metric name.
`static String` `CPU_LOAD_DESCRIPTION` CPU load metric description.
`static String` `DAEMON_THREAD_CNT` Daemon thread count metric name.
`static String` `GC_CPU_LOAD` GC CPU load metric name.
`static String` `GC_CPU_LOAD_DESCRIPTION` GC CPU load metric description.
`static String` `HISTOGRAM_CFG_PREFIX` Prefix for `HistogramMetric` configuration property name.
`static String` `HITRATE_CFG_PREFIX` Prefix for `HitRateMetric` configuration property name.
`static String` `IS_SHUTDOWN_DESC`
`static String` `IS_TERMINATED_DESC`
`static String` `IS_TERMINATING_DESC`
`static String` `KEEP_ALIVE_TIME_DESC`
`static String` `LARGEST_SIZE_DESC`
`static String` `MAX_SIZE_DESC`
`static String` `PEAK_THREAD_CNT` Peak thread count metric name.
`static String` `PME_DURATION` PME duration metric name.
`static String` `PME_DURATION_HISTOGRAM` Histogram of PME durations metric name.
`static String` `PME_METRICS` Partition map exchange metrics prefix.
`static String` `PME_OPS_BLOCKED_DURATION` PME cache operations blocked duration metric name.
`static String` `PME_OPS_BLOCKED_DURATION_HISTOGRAM` Histogram of blocking PME durations metric name.
`static String` `POOL_SIZE_DESC`
`static String` `QUEUE_SIZE_DESC`
`static String` `REBALANCED` Whether cluster is in fully rebalanced state metric name.
`static String` `REJ_HND_DESC`
`static String` `SYS_METRICS` System metrics prefix.
`static String` `TASK_COUNT_DESC`
`static String` `THRD_FACTORY_DESC`
`static String` `THREAD_CNT` Thread count metric name.
`static String` `THREAD_POOLS` Group for a thread pools.
`static String` `TOTAL_STARTED_THREAD_CNT` Total started thread count metric name.
`static String` `TX_METRICS` Transaction metrics prefix.
`static String` `UP_TIME` Up time metric name.

### Fields inherited from class org.apache.ignite.internal.managers.GridManagerAdapter

`ctx, log`

### Constructor Summary

Constructors
Constructor and Description
`GridMetricManager(GridKernalContext ctx)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addMetricRegistryCreationListener(Consumer<ReadOnlyMetricRegistry> lsnr)` Adds listener of metrics registry creation events.
`void` `addMetricRegistryRemoveListener(Consumer<ReadOnlyMetricRegistry> lsnr)` Adds listener of metrics registry remove events.
`void` `configureHistogram(String name, long[] bounds)` Stores `HistogramMetric` configuration in metastorage.
`void` `configureHitRate(String name, long rateTimeInterval)` Change `HitRateMetric` configuration if it exists.
`MemoryUsage` `heapMemoryUsage()` Returns the current memory usage of the heap.
`@NotNull Iterator<ReadOnlyMetricRegistry>` `iterator()`
`MemoryUsage` `nonHeapMemoryUsage()`
`protected void` `onKernalStart0()`

`void`

`registerThreadPools(ExecutorService utilityCachePool, ExecutorService execSvc, ExecutorService svcExecSvc, ExecutorService sysExecSvc, StripedExecutor stripedExecSvc, ExecutorService p2pExecSvc, ExecutorService mgmtExecSvc, ExecutorService igfsExecSvc, StripedExecutor dataStreamExecSvc, ExecutorService restExecSvc, ExecutorService affExecSvc, @Nullable ExecutorService idxExecSvc, IgniteStripedThreadPoolExecutor callbackExecSvc, ExecutorService qryExecSvc, ExecutorService schemaExecSvc, ExecutorService rebalanceExecSvc, IgniteStripedThreadPoolExecutor rebalanceStripedExecSvc, @Nullable Map<String,? extends ExecutorService> customExecSvcs)`
Registers all metrics for thread pools.

`MetricRegistry` `registry(String name)` Gets or creates metric registry.
`void` `remove(String regName)` Removes metric registry.
`void` `start()` Starts grid component.
`void` `stop(boolean cancel)` Stops grid component.

### Methods inherited from class org.apache.ignite.internal.managers.GridManagerAdapter

`assertParameter, collectGridNodeData, collectJoiningNodeData, discoveryDataType, enabled, getSpi, getSpi, getSpis, inject, onAfterSpiStart, onBeforeSpiStart, onDisconnected, onGridDataReceived, onJoiningNodeDataReceived, onKernalStart, onKernalStop, onKernalStop0, onReconnected, printMemoryStats, startInfo, startSpi, stopInfo, stopSpi, toString, validateNode, validateNode`

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

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

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

`forEach, spliterator`

### Field Detail

#### ACTIVE_COUNT_DESC

    public static final String ACTIVE_COUNT_DESC

See Also:
  Constant Field Values

#### COMPLETED_TASK_DESC

    public static final String COMPLETED_TASK_DESC

See Also:
  Constant Field Values

#### CORE_SIZE_DESC

    public static final String CORE_SIZE_DESC

See Also:
  Constant Field Values

#### LARGEST_SIZE_DESC

    public static final String LARGEST_SIZE_DESC

See Also:
  Constant Field Values

#### MAX_SIZE_DESC

    public static final String MAX_SIZE_DESC

See Also:
  Constant Field Values

#### POOL_SIZE_DESC

    public static final String POOL_SIZE_DESC

See Also:
  Constant Field Values

#### TASK_COUNT_DESC

    public static final String TASK_COUNT_DESC

See Also:
  Constant Field Values

#### QUEUE_SIZE_DESC

    public static final String QUEUE_SIZE_DESC

See Also:
  Constant Field Values

#### KEEP_ALIVE_TIME_DESC

    public static final String KEEP_ALIVE_TIME_DESC

See Also:
  Constant Field Values

#### IS_SHUTDOWN_DESC

    public static final String IS_SHUTDOWN_DESC

See Also:
  Constant Field Values

#### IS_TERMINATED_DESC

    public static final String IS_TERMINATED_DESC

See Also:
  Constant Field Values

#### IS_TERMINATING_DESC

    public static final String IS_TERMINATING_DESC

See Also:
  Constant Field Values

#### REJ_HND_DESC

    public static final String REJ_HND_DESC

See Also:
  Constant Field Values

#### THRD_FACTORY_DESC

    public static final String THRD_FACTORY_DESC

See Also:
  Constant Field Values

#### THREAD_POOLS

    public static final String THREAD_POOLS

Group for a thread pools.

See Also:
  Constant Field Values

#### SYS_METRICS

    public static final String SYS_METRICS

System metrics prefix.

See Also:
  Constant Field Values

#### PME_METRICS

    public static final String PME_METRICS

Partition map exchange metrics prefix.

See Also:
  Constant Field Values

#### CLUSTER_METRICS

    public static final String CLUSTER_METRICS

Cluster metrics prefix.

See Also:
  Constant Field Values

#### TX_METRICS

    public static final String TX_METRICS

Transaction metrics prefix.

See Also:
  Constant Field Values

#### GC_CPU_LOAD

    public static final String GC_CPU_LOAD

GC CPU load metric name.

See Also:
  Constant Field Values

#### GC_CPU_LOAD_DESCRIPTION

    public static final String GC_CPU_LOAD_DESCRIPTION

GC CPU load metric description.

See Also:
  Constant Field Values

#### CPU_LOAD

    public static final String CPU_LOAD

CPU load metric name.

See Also:
  Constant Field Values

#### CPU_LOAD_DESCRIPTION

    public static final String CPU_LOAD_DESCRIPTION

CPU load metric description.

See Also:
  Constant Field Values

#### UP_TIME

    public static final String UP_TIME

Up time metric name.

See Also:
  Constant Field Values

#### THREAD_CNT

    public static final String THREAD_CNT

Thread count metric name.

See Also:
  Constant Field Values

#### PEAK_THREAD_CNT

    public static final String PEAK_THREAD_CNT

Peak thread count metric name.

See Also:
  Constant Field Values

#### TOTAL_STARTED_THREAD_CNT

    public static final String TOTAL_STARTED_THREAD_CNT

Total started thread count metric name.

See Also:
  Constant Field Values

#### DAEMON_THREAD_CNT

    public static final String DAEMON_THREAD_CNT

Daemon thread count metric name.

See Also:
  Constant Field Values

#### PME_DURATION

    public static final String PME_DURATION

PME duration metric name.

See Also:
  Constant Field Values

#### PME_OPS_BLOCKED_DURATION

    public static final String PME_OPS_BLOCKED_DURATION

PME cache operations blocked duration metric name.

See Also:
  Constant Field Values

#### PME_DURATION_HISTOGRAM

    public static final String PME_DURATION_HISTOGRAM

Histogram of PME durations metric name.

See Also:
  Constant Field Values

#### PME_OPS_BLOCKED_DURATION_HISTOGRAM

    public static final String PME_OPS_BLOCKED_DURATION_HISTOGRAM

Histogram of blocking PME durations metric name.

See Also:
  Constant Field Values

#### REBALANCED

    public static final String REBALANCED

Whether cluster is in fully rebalanced state metric name.

See Also:
  Constant Field Values

#### HITRATE_CFG_PREFIX

    public static final String HITRATE_CFG_PREFIX

Prefix for `HitRateMetric` configuration property name.

#### HISTOGRAM_CFG_PREFIX

    public static final String HISTOGRAM_CFG_PREFIX

Prefix for `HistogramMetric` configuration property name.

### Constructor Detail

#### GridMetricManager

    public GridMetricManager(GridKernalContext ctx)

Parameters:
  `ctx` - Kernal context.

### Method Detail

#### onKernalStart0

    protected void onKernalStart0()

Overrides:
  `onKernalStart0` in class `GridManagerAdapter<MetricExporterSpi>`

#### start

    public void start()
               throws IgniteCheckedException

Starts grid component.

Specified by:
  `start` in interface `GridComponent`
Throws:
  `IgniteCheckedException` - Throws in case of any errors.

#### stop

    public void stop(boolean cancel)
              throws IgniteCheckedException

Stops grid component.

Specified by:
  `stop` in interface `GridComponent`
Parameters:
  `cancel` - If `true`, then all ongoing tasks or jobs for relevant components need to be cancelled.
Throws:
  `IgniteCheckedException` - Thrown in case of any errors.

#### registry

    public MetricRegistry registry(String name)

Gets or creates metric registry.

Parameters:
  `name` - Group name.
Returns:
  Group of metrics.

#### iterator

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

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

#### addMetricRegistryCreationListener

    public void addMetricRegistryCreationListener(Consumer<ReadOnlyMetricRegistry> lsnr)

Adds listener of metrics registry creation events.

Specified by:
  `addMetricRegistryCreationListener` in interface `ReadOnlyMetricManager`
Parameters:
  `lsnr` - Listener.

#### addMetricRegistryRemoveListener

    public void addMetricRegistryRemoveListener(Consumer<ReadOnlyMetricRegistry> lsnr)

Adds listener of metrics registry remove events.

Specified by:
  `addMetricRegistryRemoveListener` in interface `ReadOnlyMetricManager`
Parameters:
  `lsnr` - Listener.

#### remove

    public void remove(String regName)

Removes metric registry.

Parameters:
  `regName` - Metric registry name.

#### configureHitRate

    public void configureHitRate(String name,
                                 long rateTimeInterval)
                          throws IgniteCheckedException

Change `HitRateMetric` configuration if it exists.

Parameters:
  `name` - Metric name.
  `rateTimeInterval` - New rate time interval.
Throws:
  `IgniteCheckedException` - If write of configuration failed.
See Also:
  `HitRateMetric.reset(long, int)`

#### configureHistogram

    public void configureHistogram(String name,
                                   long[] bounds)
                            throws IgniteCheckedException

Stores `HistogramMetric` configuration in metastorage.

Parameters:
  `name` - Metric name.
  `bounds` - New bounds.
Throws:
  `IgniteCheckedException` - If write of configuration failed.

#### registerThreadPools

    public void registerThreadPools(ExecutorService utilityCachePool,
                                    ExecutorService execSvc,
                                    ExecutorService svcExecSvc,
                                    ExecutorService sysExecSvc,
                                    StripedExecutor stripedExecSvc,
                                    ExecutorService p2pExecSvc,
                                    ExecutorService mgmtExecSvc,
                                    ExecutorService igfsExecSvc,
                                    StripedExecutor dataStreamExecSvc,
                                    ExecutorService restExecSvc,
                                    ExecutorService affExecSvc,
                                    @Nullable
                                    @Nullable ExecutorService idxExecSvc,
                                    IgniteStripedThreadPoolExecutor callbackExecSvc,
                                    ExecutorService qryExecSvc,
                                    ExecutorService schemaExecSvc,
                                    ExecutorService rebalanceExecSvc,
                                    IgniteStripedThreadPoolExecutor rebalanceStripedExecSvc,
                                    @Nullable
                                    @Nullable Map<String,? extends ExecutorService> customExecSvcs)

Registers all metrics for thread pools.

Parameters:
  `utilityCachePool` - Utility cache pool.
  `execSvc` - Executor service.
  `svcExecSvc` - Services' executor service.
  `sysExecSvc` - System executor service.
  `stripedExecSvc` - Striped executor.
  `p2pExecSvc` - P2P executor service.
  `mgmtExecSvc` - Management executor service.
  `igfsExecSvc` - IGFS executor service.
  `dataStreamExecSvc` - Data stream executor service.
  `restExecSvc` - Reset executor service.
  `affExecSvc` - Affinity executor service.
  `idxExecSvc` - Indexing executor service.
  `callbackExecSvc` - Callback executor service.
  `qryExecSvc` - Query executor service.
  `schemaExecSvc` - Schema executor service.
  `rebalanceExecSvc` - Rebalance executor service.
  `rebalanceStripedExecSvc` - Rebalance striped executor service.
  `customExecSvcs` - Custom named executors.

#### nonHeapMemoryUsage

    public MemoryUsage nonHeapMemoryUsage()

Returns:
  Memory usage of non-heap memory.

#### heapMemoryUsage

    public MemoryUsage heapMemoryUsage()

Returns the current memory usage of the heap.

Returns:
  Memory usage or fake value with zero in case there was exception during take of metrics.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.1
Release Date | : May 21 2020