murblanc commented on a change in pull request #2133: URL: https://github.com/apache/lucene-solr/pull/2133#discussion_r547939345
########## File path: solr/core/src/java/org/apache/solr/cluster/placement/impl/AttributeFetcherImpl.java ########## @@ -197,32 +148,78 @@ public AttributeValues fetchAttributes() { } } - return new AttributeValuesImpl(nodeToCoreCount, - nodeToDiskType, - nodeToFreeDisk, - nodeToTotalDisk, - nodeToHeapUsage, - nodeToSystemLoadAverage, - syspropSnitchToNodeToValue, - metricSnitchToNodeToValue); + for (Node node : nodeToReplicaInternalTags.keySet()) { + Set<String> tags = nodeToReplicaInternalTags.get(node); + Map<String, Map<String, List<Replica>>> infos = cloudManager.getNodeStateProvider().getReplicaInfo(node.getName(), tags); + infos.entrySet().stream() + .filter(entry -> requestedCollectionNamesMetrics.containsKey(entry.getKey())) + .forEach(entry -> { + CollectionMetricsBuilder collectionMetricsBuilder = collectionMetricsBuilders + .computeIfAbsent(entry.getKey(), c -> new CollectionMetricsBuilder()); + entry.getValue().forEach((shardName, replicas) -> { + CollectionMetricsBuilder.ShardMetricsBuilder shardMetricsBuilder = + collectionMetricsBuilder.getShardMetricsBuilders() + .computeIfAbsent(shardName, s -> new CollectionMetricsBuilder.ShardMetricsBuilder()); + replicas.forEach(replica -> { + CollectionMetricsBuilder.ReplicaMetricsBuilder replicaMetricsBuilder = + shardMetricsBuilder.getReplicaMetricsBuilders() + .computeIfAbsent(replica.getName(), n -> new CollectionMetricsBuilder.ReplicaMetricsBuilder()); + replicaMetricsBuilder.setLeader(replica.isLeader()); + if (replica.isLeader()) { + shardMetricsBuilder.setLeaderMetrics(replicaMetricsBuilder); + } + Set<ReplicaMetric<?>> requestedMetrics = requestedCollectionNamesMetrics.get(replica.getCollection()); + if (requestedMetrics == null) { + throw new RuntimeException("impossible error"); Review comment: Likely an error log with the value of `replica.getCollection()` (or add the value to the exception text) could help understand how the impossible happens. Or just remove this check and let the NPE bubble up? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org