You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2023/02/21 15:31:36 UTC

[iotdb] branch master updated: [IOTDB-5517] Add metrics for disk io (#9113)

This is an automated email from the ASF dual-hosted git repository.

tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new d6e015eab1 [IOTDB-5517] Add metrics for disk io (#9113)
d6e015eab1 is described below

commit d6e015eab15a7011bf69c16696106601e52ec308
Author: Liu Xuxin <37...@users.noreply.github.com>
AuthorDate: Tue Feb 21 23:31:30 2023 +0800

    [IOTDB-5517] Add metrics for disk io (#9113)
---
 .../Apache-IoTDB-ConfigNode-Dashboard.json         | 123 +++++++++++++++------
 .../Apache-IoTDB-DataNode-Dashboard.json           |  25 +++--
 .../iotdb/metrics/metricsets/disk/DiskMetrics.java |  16 +--
 .../metricsets/disk/IDiskMetricsManager.java       |  24 ++--
 .../metricsets/disk/LinuxDiskMetricsManager.java   |  74 ++++++-------
 5 files changed, 162 insertions(+), 100 deletions(-)

diff --git a/docs/UserGuide/Monitor-Alert/Apache-IoTDB-ConfigNode-Dashboard.json b/docs/UserGuide/Monitor-Alert/Apache-IoTDB-ConfigNode-Dashboard.json
index 6cb23d6e6a..6a3921f2fc 100644
--- a/docs/UserGuide/Monitor-Alert/Apache-IoTDB-ConfigNode-Dashboard.json
+++ b/docs/UserGuide/Monitor-Alert/Apache-IoTDB-ConfigNode-Dashboard.json
@@ -101,7 +101,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -133,7 +134,7 @@
             },
             "textMode": "auto"
           },
-          "pluginVersion": "8.4.2",
+          "pluginVersion": "9.3.6",
           "targets": [
             {
               "datasource": {
@@ -308,6 +309,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "axisSoftMax": 2,
@@ -356,7 +359,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               },
@@ -443,7 +447,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               }
@@ -471,7 +476,7 @@
             },
             "textMode": "auto"
           },
-          "pluginVersion": "8.4.2",
+          "pluginVersion": "9.3.6",
           "targets": [
             {
               "datasource": {
@@ -520,7 +525,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               }
@@ -548,7 +554,7 @@
             },
             "textMode": "auto"
           },
-          "pluginVersion": "8.4.2",
+          "pluginVersion": "9.3.6",
           "targets": [
             {
               "datasource": {
@@ -578,6 +584,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "barAlignment": 0,
@@ -610,7 +618,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               }
@@ -663,6 +672,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "barAlignment": 0,
@@ -695,7 +706,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               }
@@ -748,6 +760,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "barAlignment": 0,
@@ -780,7 +794,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               }
@@ -833,6 +848,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "barAlignment": 0,
@@ -865,7 +882,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               }
@@ -949,7 +967,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -982,7 +1001,7 @@
             },
             "textMode": "auto"
           },
-          "pluginVersion": "8.4.2",
+          "pluginVersion": "9.3.6",
           "targets": [
             {
               "datasource": {
@@ -1011,6 +1030,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "axisSoftMax": 0,
@@ -1045,7 +1066,8 @@
                 "mode": "percentage",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               },
@@ -1113,6 +1135,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "axisSoftMax": 0,
@@ -1147,7 +1171,8 @@
                 "mode": "percentage",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               },
@@ -1202,6 +1227,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "barAlignment": 0,
@@ -1234,7 +1261,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               },
@@ -1316,6 +1344,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "barAlignment": 0,
@@ -1348,7 +1378,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               },
@@ -1448,6 +1479,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "barAlignment": 0,
@@ -1480,7 +1513,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   },
                   {
                     "color": "red",
@@ -1562,6 +1596,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "barAlignment": 0,
@@ -1594,7 +1630,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               }
@@ -1661,6 +1698,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "barAlignment": 0,
@@ -1693,7 +1732,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               },
@@ -1759,6 +1799,8 @@
                 "mode": "palette-classic"
               },
               "custom": {
+                "axisCenteredZero": false,
+                "axisColorMode": "text",
                 "axisLabel": "",
                 "axisPlacement": "auto",
                 "barAlignment": 0,
@@ -1791,7 +1833,8 @@
                 "mode": "absolute",
                 "steps": [
                   {
-                    "color": "green"
+                    "color": "green",
+                    "value": null
                   }
                 ]
               }
@@ -2480,6 +2523,7 @@
             }
           },
           "mappings": [],
+          "max": 1,
           "thresholds": {
             "mode": "percentage",
             "steps": [
@@ -2515,7 +2559,9 @@
           ],
           "displayMode": "table",
           "placement": "right",
-          "showLegend": true
+          "showLegend": true,
+          "sortBy": "Mean",
+          "sortDesc": true
         },
         "tooltip": {
           "mode": "multi",
@@ -2528,8 +2574,9 @@
             "type": "prometheus",
             "uid": "${DS_PROMETHEUS}"
           },
+          "editorMode": "code",
           "exemplar": true,
-          "expr": "disk_io_busy_percentage{instance=~\"$instance\"}/10000",
+          "expr": "disk_io_busy_percentage{instance=~\"$instance\"}",
           "instant": false,
           "interval": "",
           "legendFormat": "{{name}}",
@@ -2608,7 +2655,9 @@
           ],
           "displayMode": "table",
           "placement": "right",
-          "showLegend": true
+          "showLegend": true,
+          "sortBy": "Last",
+          "sortDesc": true
         },
         "tooltip": {
           "mode": "multi",
@@ -2701,7 +2750,9 @@
           ],
           "displayMode": "table",
           "placement": "right",
-          "showLegend": true
+          "showLegend": true,
+          "sortBy": "Max",
+          "sortDesc": true
         },
         "tooltip": {
           "mode": "multi",
@@ -2883,7 +2934,9 @@
           ],
           "displayMode": "table",
           "placement": "right",
-          "showLegend": true
+          "showLegend": true,
+          "sortBy": "Max",
+          "sortDesc": true
         },
         "tooltip": {
           "mode": "multi",
@@ -2896,10 +2949,12 @@
             "type": "prometheus",
             "uid": "${DS_PROMETHEUS}"
           },
+          "editorMode": "code",
           "exemplar": true,
-          "expr": "disk_io_avg_time{instance=~\"$instance\"}/1000000",
+          "expr": "disk_io_avg_time{instance=~\"$instance\"}",
           "interval": "",
           "legendFormat": "{{name}}-{{type}}",
+          "range": true,
           "refId": "A"
         }
       ],
@@ -2974,7 +3029,9 @@
           ],
           "displayMode": "table",
           "placement": "right",
-          "showLegend": true
+          "showLegend": true,
+          "sortBy": "Mean",
+          "sortDesc": true
         },
         "tooltip": {
           "mode": "multi",
@@ -3064,7 +3121,9 @@
           ],
           "displayMode": "table",
           "placement": "right",
-          "showLegend": true
+          "showLegend": true,
+          "sortBy": "Mean",
+          "sortDesc": true
         },
         "tooltip": {
           "mode": "multi",
@@ -3079,7 +3138,7 @@
           },
           "editorMode": "code",
           "exemplar": true,
-          "expr": "disk_io_avg_queue_size{instance=~\"$instance\"}/10000",
+          "expr": "disk_io_avg_queue_size{instance=~\"$instance\"}",
           "interval": "",
           "legendFormat": "{{name}}",
           "range": true,
@@ -3248,7 +3307,9 @@
           ],
           "displayMode": "table",
           "placement": "right",
-          "showLegend": true
+          "showLegend": true,
+          "sortBy": "Mean",
+          "sortDesc": true
         },
         "tooltip": {
           "mode": "multi",
diff --git a/docs/UserGuide/Monitor-Alert/Apache-IoTDB-DataNode-Dashboard.json b/docs/UserGuide/Monitor-Alert/Apache-IoTDB-DataNode-Dashboard.json
index 9286baca04..8431de5f7e 100644
--- a/docs/UserGuide/Monitor-Alert/Apache-IoTDB-DataNode-Dashboard.json
+++ b/docs/UserGuide/Monitor-Alert/Apache-IoTDB-DataNode-Dashboard.json
@@ -14007,6 +14007,7 @@
             }
           },
           "mappings": [],
+          "max": 1,
           "thresholds": {
             "mode": "percentage",
             "steps": [
@@ -14056,10 +14057,12 @@
             "type": "prometheus",
             "uid": "${DS_PROMETHEUS}"
           },
+          "editorMode": "code",
           "exemplar": true,
-          "expr": "disk_io_busy_percentage{instance=~\"$instance\"}/10000",
+          "expr": "disk_io_busy_percentage{instance=~\"$instance\"}",
           "interval": "",
           "legendFormat": "{{name}}",
+          "range": true,
           "refId": "A"
         }
       ],
@@ -14426,10 +14429,12 @@
             "type": "prometheus",
             "uid": "${DS_PROMETHEUS}"
           },
+          "editorMode": "code",
           "exemplar": true,
-          "expr": "disk_io_avg_time{instance=~\"$instance\"}/1000000",
+          "expr": "disk_io_avg_time{instance=~\"$instance\"}",
           "interval": "",
           "legendFormat": "{{name}}-{{type}}",
+          "range": true,
           "refId": "A"
         }
       ],
@@ -14506,7 +14511,7 @@
           "placement": "right",
           "showLegend": true,
           "sortBy": "Mean",
-          "sortDesc": true
+          "sortDesc": false
         },
         "tooltip": {
           "mode": "multi",
@@ -14613,7 +14618,7 @@
           },
           "editorMode": "code",
           "exemplar": true,
-          "expr": "disk_io_queue_avg_size{instance=~\"$instance\"}/10000",
+          "expr": "disk_io_avg_queue_size{instance=~\"$instance\"}",
           "interval": "",
           "legendFormat": "{{name}}",
           "range": true,
@@ -14668,8 +14673,7 @@
             "mode": "absolute",
             "steps": [
               {
-                "color": "green",
-                "value": null
+                "color": "green"
               }
             ]
           },
@@ -14704,10 +14708,12 @@
             "type": "prometheus",
             "uid": "${DS_PROMETHEUS}"
           },
+          "editorMode": "code",
           "exemplar": true,
           "expr": "rate(process_io_ops{instance=~\"$instance\"}[1m])",
           "interval": "",
           "legendFormat": "{{from}}-{{name}}",
+          "range": true,
           "refId": "A"
         }
       ],
@@ -14759,8 +14765,7 @@
             "mode": "absolute",
             "steps": [
               {
-                "color": "green",
-                "value": null
+                "color": "green"
               }
             ]
           },
@@ -14806,7 +14811,7 @@
       "type": "timeseries"
     }
   ],
-  "refresh": "15s",
+  "refresh": false,
   "schemaVersion": 37,
   "style": "dark",
   "tags": [
@@ -14879,6 +14884,6 @@
   "timezone": "browser",
   "title": "Apache IoTDB DataNode Dashboard",
   "uid": "TbEVYRw7A",
-  "version": 2,
+  "version": 3,
   "weekStart": ""
 }
\ No newline at end of file
diff --git a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/DiskMetrics.java b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/DiskMetrics.java
index 770de574af..00d550be49 100644
--- a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/DiskMetrics.java
+++ b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/DiskMetrics.java
@@ -68,7 +68,7 @@ public class DiskMetrics implements IMetricSet {
           DISK_IO_SIZE,
           MetricLevel.IMPORTANT,
           diskMetricsManager,
-          x -> x.getReadDataSizeForDisk().getOrDefault(diskID, 0L),
+          x -> x.getReadDataSizeForDisk().getOrDefault(diskID, 0.0),
           TYPE,
           READ,
           NAME,
@@ -77,7 +77,7 @@ public class DiskMetrics implements IMetricSet {
           DISK_IO_SIZE,
           MetricLevel.IMPORTANT,
           diskMetricsManager,
-          x -> x.getWriteDataSizeForDisk().getOrDefault(diskID, 0L),
+          x -> x.getWriteDataSizeForDisk().getOrDefault(diskID, 0.0),
           TYPE,
           WRITE,
           NAME,
@@ -140,7 +140,7 @@ public class DiskMetrics implements IMetricSet {
           DISK_IO_AVG_TIME,
           MetricLevel.IMPORTANT,
           diskMetricsManager,
-          x -> x.getAvgReadCostTimeOfEachOpsForDisk().getOrDefault(diskID, 0.0).longValue(),
+          x -> x.getAvgReadCostTimeOfEachOpsForDisk().getOrDefault(diskID, 0.0),
           TYPE,
           READ,
           NAME,
@@ -149,7 +149,7 @@ public class DiskMetrics implements IMetricSet {
           DISK_IO_AVG_TIME,
           MetricLevel.IMPORTANT,
           diskMetricsManager,
-          x -> x.getAvgWriteCostTimeOfEachOpsForDisk().getOrDefault(diskID, 0.0).longValue(),
+          x -> x.getAvgWriteCostTimeOfEachOpsForDisk().getOrDefault(diskID, 0.0),
           TYPE,
           WRITE,
           NAME,
@@ -158,7 +158,7 @@ public class DiskMetrics implements IMetricSet {
           DISK_IO_AVG_SIZE,
           MetricLevel.IMPORTANT,
           diskMetricsManager,
-          x -> x.getAvgSizeOfEachReadForDisk().getOrDefault(diskID, 0.0).longValue(),
+          x -> x.getAvgSizeOfEachReadForDisk().getOrDefault(diskID, 0.0),
           TYPE,
           READ,
           NAME,
@@ -167,7 +167,7 @@ public class DiskMetrics implements IMetricSet {
           DISK_IO_AVG_SIZE,
           MetricLevel.IMPORTANT,
           diskMetricsManager,
-          x -> x.getAvgSizeOfEachWriteForDisk().getOrDefault(diskID, 0.0).longValue(),
+          x -> x.getAvgSizeOfEachWriteForDisk().getOrDefault(diskID, 0.0),
           TYPE,
           WRITE,
           NAME,
@@ -176,14 +176,14 @@ public class DiskMetrics implements IMetricSet {
           DISK_IO_BUSY_PERCENTAGE,
           MetricLevel.IMPORTANT,
           diskMetricsManager,
-          x -> x.getIoUtilsPercentage().getOrDefault(diskID, 0L),
+          x -> x.getIoUtilsPercentage().getOrDefault(diskID, 0.0),
           NAME,
           diskID);
       metricService.createAutoGauge(
           DISK_IO_QUEUE_SIZE,
           MetricLevel.IMPORTANT,
           diskMetricsManager,
-          x -> x.getQueueSizeForDisk().getOrDefault(diskID, 0L),
+          x -> x.getQueueSizeForDisk().getOrDefault(diskID, 0.0),
           NAME,
           diskID);
     }
diff --git a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/IDiskMetricsManager.java b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/IDiskMetricsManager.java
index 0a2e7c04c0..798bfba38d 100644
--- a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/IDiskMetricsManager.java
+++ b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/IDiskMetricsManager.java
@@ -24,11 +24,11 @@ import java.util.Map;
 import java.util.Set;
 
 public interface IDiskMetricsManager {
-  default Map<String, Long> getReadDataSizeForDisk() {
+  default Map<String, Double> getReadDataSizeForDisk() {
     return Collections.emptyMap();
   }
 
-  default Map<String, Long> getWriteDataSizeForDisk() {
+  default Map<String, Double> getWriteDataSizeForDisk() {
     return Collections.emptyMap();
   }
 
@@ -56,7 +56,7 @@ public interface IDiskMetricsManager {
     return Collections.emptyMap();
   }
 
-  default Map<String, Long> getIoUtilsPercentage() {
+  default Map<String, Double> getIoUtilsPercentage() {
     return Collections.emptyMap();
   }
 
@@ -76,16 +76,16 @@ public interface IDiskMetricsManager {
     return Collections.emptyMap();
   }
 
-  default Map<String, Long> getQueueSizeForDisk() {
+  default Map<String, Double> getQueueSizeForDisk() {
     return Collections.emptyMap();
   }
 
-  default long getActualReadDataSizeForProcess() {
-    return 0L;
+  default double getActualReadDataSizeForProcess() {
+    return 0.0;
   }
 
-  default long getActualWriteDataSizeForProcess() {
-    return 0L;
+  default double getActualWriteDataSizeForProcess() {
+    return 0.0;
   }
 
   default long getReadOpsCountForProcess() {
@@ -96,12 +96,12 @@ public interface IDiskMetricsManager {
     return 0L;
   }
 
-  default long getAttemptReadSizeForProcess() {
-    return 0L;
+  default double getAttemptReadSizeForProcess() {
+    return 0.0;
   }
 
-  default long getAttemptWriteSizeForProcess() {
-    return 0L;
+  default double getAttemptWriteSizeForProcess() {
+    return 0.0;
   }
 
   default Set<String> getDiskIds() {
diff --git a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/LinuxDiskMetricsManager.java b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/LinuxDiskMetricsManager.java
index 80fd10f7c8..35c3bd5b0a 100644
--- a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/LinuxDiskMetricsManager.java
+++ b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/LinuxDiskMetricsManager.java
@@ -74,10 +74,8 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
   private static final int DISK_IO_TOTAL_TIME_OFFSET = 13;
   private static final int DISK_TIME_IN_QUEUE_OFFSET = 14;
   private static final int DEFAULT_SECTOR_SIZE = 512;
-  private static final int BYTES_PER_KB = 1024;
+  private static final double BYTES_PER_KB = 1024.0;
   private static final long UPDATE_SMALLEST_INTERVAL = 10000L;
-  private static final double AMPLIFICATION_FACTOR = 10000.0;
-  private static final double MS_TO_NS_FACTOR = 1000_000.0;
   private Set<String> diskIdSet;
   private final Map<String, Integer> diskSectorSizeMap;
   private long lastUpdateTime = 0L;
@@ -139,9 +137,9 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
   }
 
   @Override
-  public Map<String, Long> getReadDataSizeForDisk() {
+  public Map<String, Double> getReadDataSizeForDisk() {
     checkUpdate();
-    Map<String, Long> readDataMap = new HashMap<>(diskIdSet.size());
+    Map<String, Double> readDataMap = new HashMap<>(diskIdSet.size());
     for (Map.Entry<String, Long> entry : lastReadSectorCountForDisk.entrySet()) {
       int sectorSize = diskSectorSizeMap.getOrDefault(entry.getKey(), DEFAULT_SECTOR_SIZE);
       readDataMap.put(entry.getKey(), entry.getValue() * sectorSize / BYTES_PER_KB);
@@ -150,9 +148,9 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
   }
 
   @Override
-  public Map<String, Long> getWriteDataSizeForDisk() {
+  public Map<String, Double> getWriteDataSizeForDisk() {
     checkUpdate();
-    Map<String, Long> writeDataMap = new HashMap<>(diskIdSet.size());
+    Map<String, Double> writeDataMap = new HashMap<>(diskIdSet.size());
     for (Map.Entry<String, Long> entry : lastWriteSectorCountForDisk.entrySet()) {
       int sectorSize = diskSectorSizeMap.getOrDefault(entry.getKey(), DEFAULT_SECTOR_SIZE);
       writeDataMap.put(entry.getKey(), entry.getValue() * sectorSize / BYTES_PER_KB);
@@ -182,13 +180,10 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
   }
 
   @Override
-  public Map<String, Long> getIoUtilsPercentage() {
-    Map<String, Long> utilsMap = new HashMap<>(diskIdSet.size());
+  public Map<String, Double> getIoUtilsPercentage() {
+    Map<String, Double> utilsMap = new HashMap<>(diskIdSet.size());
     for (Map.Entry<String, Long> entry : incrementIoBusyTimeForDisk.entrySet()) {
-      // The result is multiplied by an amplification factor to avoid loss of precision when
-      // converted to long
-      utilsMap.put(
-          entry.getKey(), (long) (entry.getValue() * AMPLIFICATION_FACTOR / updateInterval));
+      utilsMap.put(entry.getKey(), ((double) entry.getValue()) / updateInterval);
     }
     return utilsMap;
   }
@@ -197,12 +192,11 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
   public Map<String, Double> getAvgReadCostTimeOfEachOpsForDisk() {
     Map<String, Double> avgReadTimeCostMap = new HashMap<>(diskIdSet.size());
     for (Map.Entry<String, Long> readCostEntry : incrementReadTimeCostForDisk.entrySet()) {
-      long writeOpsCount =
-          incrementReadOperationCountForDisk.getOrDefault(readCostEntry.getKey(), 1L);
-      // convert to nanosecond
+      // use Long.max to avoid NaN
+      long readOpsCount =
+          Long.max(incrementReadOperationCountForDisk.getOrDefault(readCostEntry.getKey(), 1L), 1L);
       avgReadTimeCostMap.put(
-          readCostEntry.getKey(),
-          (double) readCostEntry.getValue() / writeOpsCount * MS_TO_NS_FACTOR);
+          readCostEntry.getKey(), (double) readCostEntry.getValue() / readOpsCount);
     }
     return avgReadTimeCostMap;
   }
@@ -211,12 +205,12 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
   public Map<String, Double> getAvgWriteCostTimeOfEachOpsForDisk() {
     Map<String, Double> avgWriteTimeCostMap = new HashMap<>(diskIdSet.size());
     for (Map.Entry<String, Long> writeCostEntry : incrementWriteTimeCostForDisk.entrySet()) {
+      // use Long.max to avoid NaN
       long writeOpsCount =
-          incrementWriteOperationCountForDisk.getOrDefault(writeCostEntry.getKey(), 1L);
-      // convert to nanosecond
+          Long.max(
+              incrementWriteOperationCountForDisk.getOrDefault(writeCostEntry.getKey(), 1L), 1L);
       avgWriteTimeCostMap.put(
-          writeCostEntry.getKey(),
-          (double) writeCostEntry.getValue() / writeOpsCount * MS_TO_NS_FACTOR);
+          writeCostEntry.getKey(), (double) writeCostEntry.getValue() / writeOpsCount);
     }
     return avgWriteTimeCostMap;
   }
@@ -225,13 +219,16 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
   public Map<String, Double> getAvgSizeOfEachReadForDisk() {
     Map<String, Double> avgSizeOfReadMap = new HashMap<>(diskIdSet.size());
     for (Map.Entry<String, Long> readSectorSizeEntry : incrementReadSectorCountForDisk.entrySet()) {
+      // use Long.max to avoid NaN
       long readOpsCount =
-          incrementReadOperationCountForDisk.getOrDefault(readSectorSizeEntry.getKey(), 1L);
+          Long.max(
+              incrementReadOperationCountForDisk.getOrDefault(readSectorSizeEntry.getKey(), 1L),
+              1L);
       int sectorSize =
           diskSectorSizeMap.getOrDefault(readSectorSizeEntry.getKey(), DEFAULT_SECTOR_SIZE);
       avgSizeOfReadMap.put(
           readSectorSizeEntry.getKey(),
-          ((double) readSectorSizeEntry.getValue()) * sectorSize / readOpsCount);
+          ((double) readSectorSizeEntry.getValue()) / readOpsCount * sectorSize);
     }
     return avgSizeOfReadMap;
   }
@@ -241,13 +238,16 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
     Map<String, Double> avgSizeOfWriteMap = new HashMap<>(diskIdSet.size());
     for (Map.Entry<String, Long> writeSectorSizeEntry :
         incrementWriteSectorCountForDisk.entrySet()) {
+      // use Long.max to avoid NaN
       long writeOpsCount =
-          incrementWriteOperationCountForDisk.getOrDefault(writeSectorSizeEntry.getKey(), 1L);
+          Long.max(
+              incrementWriteOperationCountForDisk.getOrDefault(writeSectorSizeEntry.getKey(), 1L),
+              1L);
       int sectorSize =
           diskSectorSizeMap.getOrDefault(writeSectorSizeEntry.getKey(), DEFAULT_SECTOR_SIZE);
       avgSizeOfWriteMap.put(
           writeSectorSizeEntry.getKey(),
-          ((double) writeSectorSizeEntry.getValue()) * sectorSize / writeOpsCount);
+          ((double) writeSectorSizeEntry.getValue()) / writeOpsCount * sectorSize);
     }
     return avgSizeOfWriteMap;
   }
@@ -263,25 +263,21 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
   }
 
   @Override
-  public Map<String, Long> getQueueSizeForDisk() {
-    Map<String, Long> avgQueueSizeMap = new HashMap<>(diskIdSet.size());
+  public Map<String, Double> getQueueSizeForDisk() {
+    Map<String, Double> avgQueueSizeMap = new HashMap<>(diskIdSet.size());
     for (Map.Entry<String, Long> entry : incrementTimeInQueueForDisk.entrySet()) {
-      // The result is multiplied by an amplification factor to avoid loss of precision when
-      // converted to long
-      avgQueueSizeMap.put(
-          entry.getKey(),
-          (long) (((double) entry.getValue()) * AMPLIFICATION_FACTOR / updateInterval));
+      avgQueueSizeMap.put(entry.getKey(), (((double) entry.getValue()) / updateInterval));
     }
     return avgQueueSizeMap;
   }
 
   @Override
-  public long getActualReadDataSizeForProcess() {
+  public double getActualReadDataSizeForProcess() {
     return lastReallyReadSizeForProcess / BYTES_PER_KB;
   }
 
   @Override
-  public long getActualWriteDataSizeForProcess() {
+  public double getActualWriteDataSizeForProcess() {
     return lastReallyWriteSizeForProcess / BYTES_PER_KB;
   }
 
@@ -296,13 +292,13 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
   }
 
   @Override
-  public long getAttemptReadSizeForProcess() {
-    return (long) ((double) (lastAttemptReadSizeForProcess) / BYTES_PER_KB);
+  public double getAttemptReadSizeForProcess() {
+    return lastAttemptReadSizeForProcess / BYTES_PER_KB;
   }
 
   @Override
-  public long getAttemptWriteSizeForProcess() {
-    return (long) (((double) lastAttemptWriteSizeForProcess) / BYTES_PER_KB);
+  public double getAttemptWriteSizeForProcess() {
+    return lastAttemptWriteSizeForProcess / BYTES_PER_KB;
   }
 
   @Override