private void addStatsFromDistributor(int distributorIndex, ContentClusterStats clusterStats) {
        ContentClusterStats prevClusterStats = distributorToStats.put(distributorIndex, clusterStats);

        if (prevClusterStats != null) {
            documentCountTotal -= prevClusterStats.getDocumentCountTotal();
            bytesTotal -= prevClusterStats.getBytesTotal();
        }
        documentCountTotal += clusterStats.getDocumentCountTotal();
        bytesTotal += clusterStats.getBytesTotal();

        for (ContentNodeStats contentNode : aggregatedStats) {
            Integer nodeIndex = contentNode.getNodeIndex();

            ContentNodeStats statsToAdd = clusterStats.getNodeStats(nodeIndex);
            if (statsToAdd != null) {
                contentNode.add(statsToAdd);
                globallyAggregatedNodeStats.add(statsToAdd);
            }

            if (prevClusterStats != null) {
                ContentNodeStats statsToSubtract = prevClusterStats.getNodeStats(nodeIndex);
                if (statsToSubtract != null) {
                    contentNode.subtract(statsToSubtract);
                    globallyAggregatedNodeStats.subtract(statsToSubtract);
                }
            }
        }
    }
Update the aggregator with the newest available stats from a distributor.
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java