You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/10/28 03:53:49 UTC

[GitHub] [iotdb] xingtanzjr commented on a diff in pull request #7768: [IOTDB-4782] Fix systemMetrics in confignode

xingtanzjr commented on code in PR #7768:
URL: https://github.com/apache/iotdb/pull/7768#discussion_r1007584549


##########
server/src/main/java/org/apache/iotdb/db/service/metrics/SystemMetrics.java:
##########
@@ -51,21 +51,25 @@ public class SystemMetrics implements IMetricSet {
   private Future<?> currentServiceFuture;
   private final ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
   private final Set<FileStore> fileStores = new HashSet<>();
+  private boolean isDataNode = false;
   private long systemDiskTotalSpace = 0L;
   private long systemDiskFreeSpace = 0L;
 
-  public SystemMetrics() {
-    osMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
+  public SystemMetrics(boolean isDataNode) {
+    this.isDataNode = isDataNode;
+    this.osMXBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
   }
 
   @Override
   public void bindTo(AbstractMetricService metricService) {
     collectSystemCpuInfo(metricService);
-    collectSystemDiskInfo(metricService);
+    if (isDataNode) {
+      collectSystemDiskInfo(metricService);
+    }
     collectSystemMemInfo(metricService);
 
     // finally start to update the value of some metrics in async way
-    if (metricService.isEnable() && null == currentServiceFuture) {
+    if (metricService.isEnable() && null == currentServiceFuture && isDataNode) {

Review Comment:
   Let's combine the logic into collectSystemDiskInfo because it seems that this scheduled task is only serviced for `collectSystemDiskInfo `



-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org