Source:
String getNodeStatsInJSON(StatsReportType statsReportType) { String statsWrapperJSON = ""; try { long totalFetchAndAggregateStartTimeMs = time.milliseconds(); StatsSnapshot combinedSnapshot = new StatsSnapshot(0L, new HashMap<String, StatsSnapshot>()); long totalValue = 0; List<PartitionId> unreachablePartitions = new ArrayList<>(); Iterator<PartitionId> iterator = (new HashSet<>(partitionToReplicaMap.keySet())).iterator(); while (iterator.hasNext()) { PartitionId partitionId = iterator.next(); long fetchSnapshotStartTimeMs = time.milliseconds(); StatsSnapshot statsSnapshot = fetchSnapshot(partitionId, unreachablePartitions, statsReportType); if (statsSnapshot != null) { combinedSnapshot.getSubMap().put(partitionId.toString(), statsSnapshot); totalValue += statsSnapshot.getValue(); } metrics.fetchAndAggregateTimePerStoreMs.update(time.milliseconds() - fetchSnapshotStartTimeMs); } combinedSnapshot.setValue(totalValue); List<String> unreachableStores = examineUnreachablePartitions(unreachablePartitions); metrics.totalFetchAndAggregateTimeMs.update(time.milliseconds() - totalFetchAndAggregateStartTimeMs); StatsHeader statsHeader = new StatsHeader(StatsHeader.StatsDescription.QUOTA, time.milliseconds(), partitionToReplicaMap.keySet().size(), partitionToReplicaMap.keySet().size() - unreachableStores.size(), unreachableStores); statsWrapperJSON = mapper.writeValueAsString(new StatsWrapper(statsHeader, combinedSnapshot)); } catch (Exception | Error e) { metrics.statsAggregationFailureCount.inc(); logger.error("Exception while aggregating stats for Helix report", e); } return statsWrapperJSON; }

Target:
String getNodeStatsInJSON(StatsReportType statsReportType) { String statsWrapperJSON = ""; try { long totalFetchAndAggregateStartTimeMs = time.milliseconds(); StatsSnapshot combinedSnapshot = new StatsSnapshot(0L, new HashMap<String, StatsSnapshot>()); long totalValue = 0; List<PartitionId> unreachablePartitions = new ArrayList<>(); Set<PartitionId> partitionsBeforeAggregation = new HashSet<>(partitionToReplicaMap.keySet()); Iterator<PartitionId> iterator = partitionsBeforeAggregation.iterator(); while (iterator.hasNext()) { PartitionId partitionId = iterator.next(); long fetchSnapshotStartTimeMs = time.milliseconds(); StatsSnapshot statsSnapshot = fetchSnapshot(partitionId, unreachablePartitions, statsReportType); if (statsSnapshot != null) { combinedSnapshot.getSubMap().put(partitionId.toString(), statsSnapshot); totalValue += statsSnapshot.getValue(); } metrics.fetchAndAggregateTimePerStoreMs.update(time.milliseconds() - fetchSnapshotStartTimeMs); } combinedSnapshot.setValue(totalValue); List<String> examinedUnreachableStores = examineUnreachablePartitions(unreachablePartitions); metrics.totalFetchAndAggregateTimeMs.update(time.milliseconds() - totalFetchAndAggregateStartTimeMs); StatsHeader statsHeader = new StatsHeader(StatsHeader.StatsDescription.QUOTA, time.milliseconds(), partitionsBeforeAggregation.size(), partitionsBeforeAggregation.size() - unreachablePartitions.size(), examinedUnreachableStores); statsWrapperJSON = mapper.writeValueAsString(new StatsWrapper(statsHeader, combinedSnapshot)); } catch (Exception | Error e) { metrics.statsAggregationFailureCount.inc(); logger.error("Exception while aggregating stats for Helix report", e); } return statsWrapperJSON; }