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 Modifier and Type Class Description static classIgniteStatisticsRepository.VersionedStatisticsObject statistics with topology version to which it is actual for.
-
Field Summary
Fields Modifier and Type Field Description static StringSTAT_LOCAL_DATA_VIEWStatistics local data view name.static StringSTAT_LOCAL_DATA_VIEW_DESCStatistics local data view description.static StringSTAT_PART_DATA_VIEWStatistics partition data view name.static StringSTAT_PART_DATA_VIEW_DESCStatistics partition data view description.
-
Constructor Summary
Constructors Constructor Description IgniteStatisticsRepository(IgniteStatisticsStore store, GridSystemViewManager sysViewMgr, IgniteStatisticsHelper helper, Function<Class<?>,IgniteLogger> logSupplier)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectStatisticsImplaggregatedLocalStatistics(Collection<ObjectPartitionStatisticsImpl> stats, StatisticsObjectConfiguration cfg, AffinityTopologyVersion topVer)Scan local partitioned statistic and aggregate local statistic for specified statistic object.voidclearLocalPartitionsStatistics(StatisticsKey key, Set<Integer> partsToRemove)Clear specified partition ids statistics.Collection<ObjectPartitionStatisticsImpl>getLocalPartitionsStatistics(StatisticsKey key)Get local partition statistics by specified object.ObjectPartitionStatisticsImplgetLocalPartitionStatistics(StatisticsKey key, int partId)Get partition statistics.ObjectStatisticsImplgetLocalStatistics(StatisticsKey key, AffinityTopologyVersion topVer)Get local statistics.IntMap<ObjectPartitionStatisticsObsolescence>getObsolescence(StatisticsKey key)Get map partitionId to partition obsolescence by key.ObjectPartitionStatisticsObsolescencegetObsolescence(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.voidrefreshObsolescence(StatisticsKey key, int partId)Refresh statistics obsolescence and save clear object to store, after partition gathering.voidreplaceLocalPartitionStatistics(StatisticsKey key, ObjectPartitionStatisticsImpl statistics)Save specified local partition statistics.voidsaveLocalStatistics(StatisticsKey key, ObjectStatisticsImpl statistics, AffinityTopologyVersion topVer)Save local object statistics.voidsaveObsolescenceInfo(StatisticsKey key)Save obsolescence info by specified key.voidstart()Start repository.IgniteStatisticsStorestatisticsStore()voidstop()Stop repository.voidsubscribeToLocalStatistics(Consumer<ObjectStatisticsEvent> subscriber)Subscribe to all local statistics changes.
-
-
-
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
nullif 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
nullif 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
nullif 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.
-
-