You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/04/29 16:27:31 UTC

[GitHub] [spark] xkrogen commented on a change in pull request #32388: [SPARK-35258][SHUFFLE][YARN] Add new metrics to ExternalShuffleService for better monitoring

xkrogen commented on a change in pull request #32388:
URL: https://github.com/apache/spark/pull/32388#discussion_r623209427



##########
File path: common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalBlockHandler.java
##########
@@ -98,10 +99,10 @@ public ExternalBlockHandler(
       OneForOneStreamManager streamManager,
       ExternalShuffleBlockResolver blockManager,
       MergedShuffleFileManager mergeManager) {
-    this.metrics = new ShuffleMetrics();
     this.streamManager = streamManager;
     this.blockManager = blockManager;
     this.mergeManager = mergeManager;
+    this.metrics = new ShuffleMetrics();

Review comment:
       Great question! Changing from:
   ```
         allMetrics.put("registeredExecutorsSize",
                        (Gauge<Integer>) () -> blockManager.getRegisteredExecutorsSize());
   ```
   to
   ```
         allMetrics.put("registeredExecutorsSize",
             (Gauge<Integer>) blockManager::getRegisteredExecutorsSize);
   ```
   Means that the `blockManager` object is evaluated at the time of `new ShuffleMetrics()`, instead of later at the time the metrics are gathered. When the instantiation is the first line, `blockManager` is still null. If it's at the end, `blockManager` has been initialized by then.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org