zuston commented on code in PR #1400:
URL: 
https://github.com/apache/incubator-uniffle/pull/1400#discussion_r1439292631


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -538,6 +538,19 @@ public class ShuffleServerConf extends RssBaseConf {
                   + "network_bandwidth = 10Gbps, buffer size should be ~ 
1.25MB."
                   + "Default is 0, OS will dynamically adjust the buf size.");
 
+  public static final ConfigOption<Integer> 
SERVER_SHUFFLE_DATA_METRIC_TOP_NUMBER =
+      ConfigOptions.key("rss.server.shuffle.data.metric.top.number")

Review Comment:
   The name is not accurate, what's the shuffle data metric? I think here you 
want to expose the topN of app level total shuffle size.



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServer.java:
##########
@@ -88,12 +88,13 @@ public class ShuffleServer {
   private ShuffleBufferManager shuffleBufferManager;
   private StorageManager storageManager;
   private HealthCheck healthCheck;
-  private Set<String> tags = Sets.newHashSet();
+  private final Set<String> tags = Sets.newHashSet();

Review Comment:
   why changing this? 



##########
server/src/main/java/org/apache/uniffle/server/ShuffleTaskInfo.java:
##########
@@ -42,15 +42,19 @@ public class ShuffleTaskInfo {
   private final String appId;
   private Long currentTimes;
   /** shuffleId -> commit count */
-  private Map<Integer, AtomicInteger> commitCounts;
+  private final Map<Integer, AtomicInteger> commitCounts;
 
-  private Map<Integer, Object> commitLocks;
+  private final Map<Integer, Object> commitLocks;
   /** shuffleId -> blockIds */
-  private Map<Integer, Roaring64NavigableMap> cachedBlockIds;
+  private final Map<Integer, Roaring64NavigableMap> cachedBlockIds;
 
   private AtomicReference<String> user;
 
-  private AtomicLong totalDataSize = new AtomicLong(0);
+  private final AtomicLong totalDataSize = new AtomicLong(0);
+  private final AtomicLong totalDataSizeInMemory = new AtomicLong(0);
+  private final AtomicLong totalDataSizeOnDisk = new AtomicLong(0);
+  private final AtomicLong totalDataSizeRemote = new AtomicLong(0);

Review Comment:
   `remote` is not accurate. I hope the naming should be careful, `hadoop` is 
more accurate



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerConf.java:
##########
@@ -538,6 +538,19 @@ public class ShuffleServerConf extends RssBaseConf {
                   + "network_bandwidth = 10Gbps, buffer size should be ~ 
1.25MB."
                   + "Default is 0, OS will dynamically adjust the buf size.");
 
+  public static final ConfigOption<Integer> 
SERVER_SHUFFLE_DATA_METRIC_TOP_NUMBER =
+      ConfigOptions.key("rss.server.shuffle.data.metric.top.number")
+          .intType()
+          .defaultValue(10)
+          .withDescription(
+              "size of topN when calc max shuffle data in memory、on 
disk、remote HDFS or total.");
+
+  public static final ConfigOption<Integer> 
SERVER_SHUFFLE_DATA_METRIC_REFRESH_INTERVAL =
+      ConfigOptions.key("rss.server.shuffle.data.metric.refresh.interval")

Review Comment:
   ditto



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServer.java:
##########
@@ -193,6 +194,7 @@ public void stopServer() throws Exception {
     if (executorService != null) {
       executorService.shutdownNow();
     }
+    shuffleTaskManager.stop();

Review Comment:
   if the shuffleTaskManager is not identified as `final`,  you should check 
null



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerMetrics.java:
##########
@@ -111,6 +111,11 @@ public class ShuffleServerMetrics {
   private static final String TOTAL_REMOVE_RESOURCE_BY_SHUFFLE_IDS_TIME =
       "total_remove_resource_by_shuffle_ids_time";
 
+  private static final String TOP_N_TOTAL_SHUFFLE_DATA = 
"top_N_total_shuffle_data";

Review Comment:
   this all metrics newly introduced are not consistent with their names.
   
   I think the
   
   `topN_of_total_data_size_for_app`
   `topN_of_on_memory_data_size_for_app`
   `topN_of_on_localfile_data_size_for_app`
   `topN_of_on_hadoop_data_size_for_app`
   
   How about this?



##########
server/src/main/java/org/apache/uniffle/server/ShuffleDataExporterTask.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.uniffle.server;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import io.prometheus.client.Gauge;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ShuffleDataExporterTask {

Review Comment:
   The class name is not accurate.



##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerMetrics.java:
##########
@@ -111,6 +111,11 @@ public class ShuffleServerMetrics {
   private static final String TOTAL_REMOVE_RESOURCE_BY_SHUFFLE_IDS_TIME =
       "total_remove_resource_by_shuffle_ids_time";
 
+  private static final String TOP_N_TOTAL_SHUFFLE_DATA = 
"top_N_total_shuffle_data";

Review Comment:
   I'm not sure these metrics are about app? 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to