Package org.apache.ignite.internal.processors.query.stat

## Class IgniteStatisticsRepository

- java.lang.Object
- - org.apache.ignite.internal.processors.query.stat.IgniteStatisticsRepository

    public class IgniteStatisticsRepository
    extends Object

Statistics repository implementation. Store all statistics data (except configuration) and offer high level operations to transform it.

### Nested Class Summary

Nested Classes
`static class` `IgniteStatisticsRepository.VersionedStatistics` Object statistics with topology version to which it is actual for.

### Field Summary

Fields
`static String` `STAT_LOCAL_DATA_VIEW` Statistics local data view name.
`static String` `STAT_LOCAL_DATA_VIEW_DESC` Statistics local data view description.
`static String` `STAT_PART_DATA_VIEW` Statistics partition data view name.
`static String` `STAT_PART_DATA_VIEW_DESC` Statistics partition data view description.

### Constructor Summary

Constructors
`IgniteStatisticsRepository​(IgniteStatisticsStore store, GridSystemViewManager sysViewMgr, IgniteStatisticsHelper helper, Function<Class<?>,​IgniteLogger> logSupplier)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`ObjectStatisticsImpl` `aggregatedLocalStatistics​(Collection<ObjectPartitionStatisticsImpl> stats, StatisticsObjectConfiguration cfg, AffinityTopologyVersion topVer)` Scan local partitioned statistic and aggregate local statistic for specified statistic object.
`void` `clearLocalPartitionsStatistics​(StatisticsKey key, Set<Integer> partsToRemove)` Clear specified partition ids statistics.
`Collection<ObjectPartitionStatisticsImpl>` `getLocalPartitionsStatistics​(StatisticsKey key)` Get local partition statistics by specified object.
`ObjectPartitionStatisticsImpl` `getLocalPartitionStatistics​(StatisticsKey key, int partId)` Get partition statistics.
`ObjectStatisticsImpl` `getLocalStatistics​(StatisticsKey key, AffinityTopologyVersion topVer)` Get local statistics.
`IntMap<ObjectPartitionStatisticsObsolescence>` `getObsolescence​(StatisticsKey key)` Get map partitionId to partition obsolescence by key.
`ObjectPartitionStatisticsObsolescence` `getObsolescence​(StatisticsKey key, int partId)` Get partition obsolescence info.
`List<StatisticsKey>` `getObsolescenceKeys()` Get list of all obsolescence keys.
`Map<StatisticsKey,​IgniteStatisticsRepository.VersionedStatistics>` `localStatisticsMap()` Get all local statistics.
`void` `refreshObsolescence​(StatisticsKey key, int partId)` Refresh statistics obsolescence and save clear object to store, after partition gathering.
`void` `replaceLocalPartitionStatistics​(StatisticsKey key, ObjectPartitionStatisticsImpl statistics)` Save specified local partition statistics.
`void` `saveLocalStatistics​(StatisticsKey key, ObjectStatisticsImpl statistics, AffinityTopologyVersion topVer)` Save local object statistics.
`void` `saveObsolescenceInfo​(StatisticsKey key)` Save obsolescence info by specified key.
`void` `start()` Start repository.
`IgniteStatisticsStore` `statisticsStore()`
`void` `stop()` Stop repository.
`void` `subscribeToLocalStatistics​(Consumer<ObjectStatisticsEvent> subscriber)` Subscribe to all local statistics changes.

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

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

### Field Detail

#### STAT_PART_DATA_VIEW

    public static final String STAT_PART_DATA_VIEW

Statistics partition data view name.

See Also:
  Constant Field Values

#### STAT_PART_DATA_VIEW_DESC

    public static final String STAT_PART_DATA_VIEW_DESC

Statistics partition data view description.

See Also:
  Constant Field Values

#### STAT_LOCAL_DATA_VIEW

    public static final String STAT_LOCAL_DATA_VIEW

Statistics local data view name.

See Also:
  Constant Field Values

#### STAT_LOCAL_DATA_VIEW_DESC

    public static final String STAT_LOCAL_DATA_VIEW_DESC

Statistics local data view description.

See Also:
  Constant Field Values

### Constructor Detail

#### IgniteStatisticsRepository

    public IgniteStatisticsRepository​(IgniteStatisticsStore store,
                                      GridSystemViewManager sysViewMgr,
                                      IgniteStatisticsHelper helper,
                                      Function<Class<?>,​IgniteLogger> logSupplier)

Constructor.

Parameters:
  `store` - Ignite statistics store to use.
  `sysViewMgr` - Grid system view manager.
  `helper` - IgniteStatisticsHelper.
  `logSupplier` - Ignite logger supplier to get logger from.

### Method Detail

#### getLocalPartitionsStatistics

    public Collection<ObjectPartitionStatisticsImpl> getLocalPartitionsStatistics​(StatisticsKey key)

Get local partition statistics by specified object.

Parameters:
  `key` - Object to get statistics by.
Returns:
  Collection of partitions statistics.

#### getObsolescence

    public ObjectPartitionStatisticsObsolescence getObsolescence​(StatisticsKey key,
                                                                 int partId)

Get partition obsolescence info.

Parameters:
  `key` - Statistics key.
  `partId` - Parititon id.
Returns:
  Partition obsolescence info or `null` if it doesn't exist.

#### refreshObsolescence

    public void refreshObsolescence​(StatisticsKey key,
                                    int partId)

Refresh statistics obsolescence and save clear object to store, after partition gathering.

Parameters:
  `key` - Statistics key.
  `partId` - Partition id.

#### replaceLocalPartitionStatistics

    public void replaceLocalPartitionStatistics​(StatisticsKey key,
                                                ObjectPartitionStatisticsImpl statistics)

Save specified local partition statistics.

Parameters:
  `key` - Object key.
  `statistics` - Statistics to save.

#### getLocalPartitionStatistics

    public ObjectPartitionStatisticsImpl getLocalPartitionStatistics​(StatisticsKey key,
                                                                     int partId)

Get partition statistics.

Parameters:
  `key` - Object key.
  `partId` - Partition id.
Returns:
  Object partition statistics or `null` if there are no statistics collected for such partition.

#### saveLocalStatistics

    public void saveLocalStatistics​(StatisticsKey key,
                                    ObjectStatisticsImpl statistics,
                                    AffinityTopologyVersion topVer)

Save local object statistics.

Parameters:
  `key` - Object key.
  `statistics` - Statistics to save.
  `topVer` - Topology version.

#### clearLocalPartitionsStatistics

    public void clearLocalPartitionsStatistics​(StatisticsKey key,
                                               Set<Integer> partsToRemove)

Clear specified partition ids statistics.

Parameters:
  `key` - Key to remove statistics by.
  `partsToRemove` - Set of parititon ids to remove.

#### getLocalStatistics

    public ObjectStatisticsImpl getLocalStatistics​(StatisticsKey key,
                                                   AffinityTopologyVersion topVer)

Get local statistics.

Parameters:
  `key` - Object key to load statistics by.
  `topVer` - Required topology version.
Returns:
  Object local statistics or `null` if there are no statistics collected for such object.

#### localStatisticsMap

    public Map<StatisticsKey,​IgniteStatisticsRepository.VersionedStatistics> localStatisticsMap()

Get all local statistics. Return internal map without copying.

Returns:
  Local (for current node) object statistics.

#### statisticsStore

    public IgniteStatisticsStore statisticsStore()

Returns:
  Ignite statistics store.

#### aggregatedLocalStatistics

    public ObjectStatisticsImpl aggregatedLocalStatistics​(Collection<ObjectPartitionStatisticsImpl> stats,
                                                          StatisticsObjectConfiguration cfg,
                                                          AffinityTopologyVersion topVer)

Scan local partitioned statistic and aggregate local statistic for specified statistic object.

Parameters:
  `stats` - Partitions statistics to aggregate.
  `cfg` - Statistic configuration to specify statistic object to aggregate.
  `topVer` - Topology version to which specified partition set actual for.
Returns:
  aggregated local statistic.

#### stop

    public void stop()

Stop repository.

#### start

    public void start()

Start repository.

#### getObsolescenceKeys

    public List<StatisticsKey> getObsolescenceKeys()

Get list of all obsolescence keys.

Returns:
  List of all obsolescence keys.

#### getObsolescence

    public IntMap<ObjectPartitionStatisticsObsolescence> getObsolescence​(StatisticsKey key)

Get map partitionId to partition obsolescence by key.

Parameters:
  `key` - Statistics key to get obsolescence info by.
Returns:
  Obsolescence map.

#### saveObsolescenceInfo

    public void saveObsolescenceInfo​(StatisticsKey key)

Save obsolescence info by specified key. Reset dirty flags.

Parameters:
  `key` - Key to save obsolescence info by.

#### subscribeToLocalStatistics

    public void subscribeToLocalStatistics​(Consumer<ObjectStatisticsEvent> subscriber)

Subscribe to all local statistics changes.

Parameters:
  `subscriber` - Local statitics subscriber.