use of com.github.ambry.store.StoreStats in project ambry by linkedin.
the class StatsManager method collectAndAggregateAccountStorageStats.
/**
* Fetch and aggregate account stats from a given {@link Store}
* @param hostStorageStatsMap map from partition id to container storage stats.
* @param partitionId specifies the {@link Store} to be fetched from
* @param unreachablePartitions a {@link List} containing partition Ids that were unable to successfully fetch from
*/
void collectAndAggregateAccountStorageStats(Map<Long, Map<Short, Map<Short, ContainerStorageStats>>> hostStorageStatsMap, PartitionId partitionId, List<PartitionId> unreachablePartitions) {
Store store = storageManager.getStore(partitionId, false);
if (store == null) {
unreachablePartitions.add(partitionId);
} else {
try {
long fetchAndAggregatePerStoreStartTimeMs = time.milliseconds();
StoreStats storeStats = store.getStoreStats();
Map<Short, Map<Short, ContainerStorageStats>> containerStatsMap = storeStats.getContainerStorageStats(time.milliseconds(), publishExcludeAccountIds);
hostStorageStatsMap.put(partitionId.getId(), containerStatsMap);
metrics.fetchAndAggregateTimePerStoreMs.update(time.milliseconds() - fetchAndAggregatePerStoreStartTimeMs);
// update delete tombstone stats
updateDeleteTombstoneStats(storeStats);
} catch (StoreException e) {
unreachablePartitions.add(partitionId);
}
}
}
use of com.github.ambry.store.StoreStats in project ambry by linkedin.
the class StatsManager method collectAndAggregatePartitionClassStorageStats.
/**
* Fetch and aggregate partition class stats from a given {@link Store}
* @param hostPartitionClassStorageStatsMap map from partition class to all partition storage stats.
* @param partitionId specifies the {@link Store} to be fetched from
* @param unreachablePartitions a {@link List} containing partition Ids that were unable to successfully fetch from
*/
void collectAndAggregatePartitionClassStorageStats(Map<String, Map<Long, Map<Short, Map<Short, ContainerStorageStats>>>> hostPartitionClassStorageStatsMap, PartitionId partitionId, List<PartitionId> unreachablePartitions) {
Store store = storageManager.getStore(partitionId, false);
if (store == null) {
unreachablePartitions.add(partitionId);
} else {
try {
long fetchAndAggregatePerStoreStartTimeMs = time.milliseconds();
StoreStats storeStats = store.getStoreStats();
Map<Short, Map<Short, ContainerStorageStats>> containerStatsMap = storeStats.getContainerStorageStats(time.milliseconds(), publishExcludeAccountIds);
String partitionClassName = partitionId.getPartitionClass();
hostPartitionClassStorageStatsMap.computeIfAbsent(partitionClassName, k -> new HashMap<>()).put(partitionId.getId(), containerStatsMap);
metrics.fetchAndAggregateTimePerStoreMs.update(time.milliseconds() - fetchAndAggregatePerStoreStartTimeMs);
} catch (StoreException e) {
unreachablePartitions.add(partitionId);
}
}
}
Aggregations