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/20 07:22:37 UTC
[iotdb] branch master updated: [IOTDB-5517] Add metrics for disk io (#9094)
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 91045d9b3c [IOTDB-5517] Add metrics for disk io (#9094)
91045d9b3c is described below
commit 91045d9b3cb826a12fca0ffb5def856cf16fff46
Author: Liu Xuxin <37...@users.noreply.github.com>
AuthorDate: Mon Feb 20 15:22:31 2023 +0800
[IOTDB-5517] Add metrics for disk io (#9094)
---
.../iotdb/confignode/service/ConfigNode.java | 3 +-
.../Apache-IoTDB-ConfigNode-Dashboard.json | 125 +++++++++++---
.../Apache-IoTDB-DataNode-Dashboard.json | 141 ++++++++++++----
.../iotdb/metrics/metricsets/disk/DiskMetrics.java | 17 +-
.../metricsets/disk/IDiskMetricsManager.java | 87 +++++++---
.../metricsets/disk/LinuxDiskMetricsManager.java | 179 ++++++++++++++-------
.../metricsets/disk/MacDiskMetricsManager.java | 116 +------------
.../metricsets/disk/WindowsDiskMetricsManager.java | 116 +------------
.../db/service/metrics/DataNodeMetricsHelper.java | 3 +-
9 files changed, 414 insertions(+), 373 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java b/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
index 2e8426abcc..139bf1f32d 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java
@@ -21,6 +21,7 @@ package org.apache.iotdb.confignode.service;
import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation;
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
+import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.iotdb.commons.exception.StartupException;
import org.apache.iotdb.commons.service.JMXService;
import org.apache.iotdb.commons.service.RegisterManager;
@@ -232,7 +233,7 @@ public class ConfigNode implements ConfigNodeMBean {
MetricService.getInstance().addMetricSet(new LogbackMetrics());
MetricService.getInstance().addMetricSet(new ProcessMetrics());
MetricService.getInstance().addMetricSet(new SystemMetrics(false));
- MetricService.getInstance().addMetricSet(new DiskMetrics("ConfigNode"));
+ MetricService.getInstance().addMetricSet(new DiskMetrics(IoTDBConstant.CN_ROLE));
LOGGER.info("Successfully setup internal services.");
}
diff --git a/docs/UserGuide/Monitor-Alert/Apache-IoTDB-ConfigNode-Dashboard.json b/docs/UserGuide/Monitor-Alert/Apache-IoTDB-ConfigNode-Dashboard.json
index 0f0f0b06a3..6cb23d6e6a 100644
--- a/docs/UserGuide/Monitor-Alert/Apache-IoTDB-ConfigNode-Dashboard.json
+++ b/docs/UserGuide/Monitor-Alert/Apache-IoTDB-ConfigNode-Dashboard.json
@@ -9,13 +9,13 @@
"pluginName": "Prometheus"
}
],
- "__elements": [],
+ "__elements": {},
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
- "version": "8.4.2"
+ "version": "9.3.6"
},
{
"type": "panel",
@@ -69,7 +69,6 @@
"fiscalYearStartMonth": 0,
"graphTooltip": 1,
"id": null,
- "iteration": 1676560952970,
"links": [],
"liveNow": false,
"panels": [
@@ -77,7 +76,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -407,7 +406,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -419,7 +418,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -913,7 +912,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -925,7 +924,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -2405,7 +2404,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -2415,6 +2414,10 @@
},
{
"collapsed": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "lfuOmw1Vk"
+ },
"gridPos": {
"h": 1,
"w": 24,
@@ -2423,16 +2426,31 @@
},
"id": 29,
"panels": [],
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "lfuOmw1Vk"
+ },
+ "refId": "A"
+ }
+ ],
"title": "Disk I/O",
"type": "row"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMax": 1,
@@ -2496,7 +2514,8 @@
"mean"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -2521,12 +2540,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -2582,7 +2607,8 @@
"last"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -2607,12 +2633,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -2668,7 +2700,8 @@
"max"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -2692,12 +2725,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -2750,7 +2789,8 @@
"legend": {
"calcs": [],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -2774,6 +2814,10 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"description": "",
"fieldConfig": {
"defaults": {
@@ -2781,6 +2825,8 @@
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -2836,7 +2882,8 @@
"max"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -2860,12 +2907,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -2903,7 +2956,7 @@
}
]
},
- "unit": "kbytes"
+ "unit": "bytes"
},
"overrides": []
},
@@ -2920,7 +2973,8 @@
"mean"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -2934,7 +2988,7 @@
"uid": "${DS_PROMETHEUS}"
},
"exemplar": true,
- "expr": "disk_io_sector_num{instance=~\"$instance\"}*512/1024",
+ "expr": "disk_io_avg_size{instance=~\"$instance\"}",
"interval": "",
"legendFormat": "{{name}}-{{type}}",
"refId": "A"
@@ -2944,12 +2998,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -3003,7 +3063,8 @@
"mean"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -3016,23 +3077,31 @@
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
+ "editorMode": "code",
"exemplar": true,
- "expr": "disk_io_queue_size{instance=~\"$instance\"}",
+ "expr": "disk_io_avg_queue_size{instance=~\"$instance\"}/10000",
"interval": "",
"legendFormat": "{{name}}",
+ "range": true,
"refId": "A"
}
],
- "title": "Disk I/O Queue Size",
+ "title": "Disk I/O Avg Queue Size",
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -3087,7 +3156,8 @@
"mean"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -3111,12 +3181,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -3171,7 +3247,8 @@
"mean"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -3196,7 +3273,7 @@
}
],
"refresh": "15s",
- "schemaVersion": 35,
+ "schemaVersion": 37,
"style": "dark",
"tags": [
"Apache-IoTDB",
@@ -3268,6 +3345,6 @@
"timezone": "browser",
"title": "Apache IoTDB ConfigNode Dashboard",
"uid": "TbEVYRw7T",
- "version": 6,
+ "version": 3,
"weekStart": ""
}
\ No newline at end of file
diff --git a/docs/UserGuide/Monitor-Alert/Apache-IoTDB-DataNode-Dashboard.json b/docs/UserGuide/Monitor-Alert/Apache-IoTDB-DataNode-Dashboard.json
index 309d059daa..9286baca04 100644
--- a/docs/UserGuide/Monitor-Alert/Apache-IoTDB-DataNode-Dashboard.json
+++ b/docs/UserGuide/Monitor-Alert/Apache-IoTDB-DataNode-Dashboard.json
@@ -9,13 +9,13 @@
"pluginName": "Prometheus"
}
],
- "__elements": [],
+ "__elements": {},
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
- "version": "8.4.2"
+ "version": "9.3.6"
},
{
"type": "datasource",
@@ -63,7 +63,6 @@
"fiscalYearStartMonth": 0,
"graphTooltip": 1,
"id": null,
- "iteration": 1676553459309,
"links": [],
"liveNow": false,
"panels": [
@@ -71,7 +70,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -348,7 +347,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -360,7 +359,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -1090,7 +1089,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -1102,7 +1101,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -1816,7 +1815,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -1828,7 +1827,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -5207,7 +5206,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -5219,7 +5218,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -9039,7 +9038,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -9051,7 +9050,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -10786,7 +10785,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -10798,7 +10797,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -12158,7 +12157,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -12170,7 +12169,7 @@
"collapsed": true,
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"gridPos": {
"h": 1,
@@ -13931,7 +13930,7 @@
{
"datasource": {
"type": "prometheus",
- "uid": "${DS_PROMETHEUS}"
+ "uid": "lfuOmw1Vk"
},
"refId": "A"
}
@@ -13941,6 +13940,10 @@
},
{
"collapsed": false,
+ "datasource": {
+ "type": "prometheus",
+ "uid": "lfuOmw1Vk"
+ },
"gridPos": {
"h": 1,
"w": 24,
@@ -13949,16 +13952,31 @@
},
"id": 177,
"panels": [],
+ "targets": [
+ {
+ "datasource": {
+ "type": "prometheus",
+ "uid": "lfuOmw1Vk"
+ },
+ "refId": "A"
+ }
+ ],
"title": "Disk Status",
"type": "row"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMax": 1,
@@ -14024,7 +14042,8 @@
"last"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -14048,12 +14067,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -14109,7 +14134,8 @@
"last"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "none",
@@ -14133,12 +14159,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -14195,6 +14227,7 @@
],
"displayMode": "table",
"placement": "right",
+ "showLegend": true,
"sortBy": "Mean",
"sortDesc": true
},
@@ -14220,12 +14253,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -14278,7 +14317,8 @@
"legend": {
"calcs": [],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -14302,12 +14342,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -14365,6 +14411,7 @@
],
"displayMode": "table",
"placement": "right",
+ "showLegend": true,
"sortBy": "Mean",
"sortDesc": true
},
@@ -14390,12 +14437,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -14433,7 +14486,7 @@
}
]
},
- "unit": "deckbytes"
+ "unit": "bytes"
},
"overrides": []
},
@@ -14451,6 +14504,7 @@
],
"displayMode": "table",
"placement": "right",
+ "showLegend": true,
"sortBy": "Mean",
"sortDesc": true
},
@@ -14466,7 +14520,7 @@
"uid": "${DS_PROMETHEUS}"
},
"exemplar": true,
- "expr": "disk_io_sector_num{instance=~\"$instance\"}*512/1024",
+ "expr": "disk_io_avg_size{instance=~\"$instance\"}",
"interval": "",
"legendFormat": "{{name}}-{{type}}",
"refId": "A"
@@ -14476,12 +14530,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -14536,6 +14596,7 @@
],
"displayMode": "table",
"placement": "right",
+ "showLegend": true,
"sortBy": "Mean",
"sortDesc": true
},
@@ -14550,23 +14611,31 @@
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
+ "editorMode": "code",
"exemplar": true,
- "expr": "disk_io_queue_size{instance=~\"$instance\"}",
+ "expr": "disk_io_queue_avg_size{instance=~\"$instance\"}/10000",
"interval": "",
"legendFormat": "{{name}}",
+ "range": true,
"refId": "A"
}
],
- "title": "Disk I/O Queue Size",
+ "title": "Disk I/O Avg Queue Size",
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -14621,7 +14690,8 @@
"mean"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -14645,12 +14715,18 @@
"type": "timeseries"
},
{
+ "datasource": {
+ "type": "prometheus",
+ "uid": "${DS_PROMETHEUS}"
+ },
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
+ "axisCenteredZero": false,
+ "axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -14705,7 +14781,8 @@
"mean"
],
"displayMode": "table",
- "placement": "right"
+ "placement": "right",
+ "showLegend": true
},
"tooltip": {
"mode": "multi",
@@ -14730,7 +14807,7 @@
}
],
"refresh": "15s",
- "schemaVersion": 35,
+ "schemaVersion": 37,
"style": "dark",
"tags": [
"Apache-IoTDB",
@@ -14786,8 +14863,8 @@
]
},
"time": {
- "from": "2023-02-15T02:53:41.626Z",
- "to": "2023-02-15T07:39:53.174Z"
+ "from": "now-5m",
+ "to": "now"
},
"timepicker": {
"refresh_intervals": [
@@ -14802,6 +14879,6 @@
"timezone": "browser",
"title": "Apache IoTDB DataNode Dashboard",
"uid": "TbEVYRw7A",
- "version": 8,
+ "version": 2,
"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 392c27c05f..770de574af 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
@@ -48,9 +48,10 @@ public class DiskMetrics implements IMetricSet {
private static final String DISK_IO_OPS = "disk_io_ops";
private static final String DISK_IO_TIME = "disk_io_time";
private static final String DISK_IO_AVG_TIME = "disk_io_avg_time";
- private static final String DISK_IO_SECTOR_NUM = "disk_io_sector_num";
+ private static final String DISK_IO_AVG_SIZE = "disk_io_avg_size";
private static final String DISK_IO_BUSY_PERCENTAGE = "disk_io_busy_percentage";
- private static final String DISK_IO_QUEUE_SIZE = "disk_io_queue_size";
+ private static final String DISK_IO_QUEUE_SIZE = "disk_io_avg_queue_size";
+
private static final String PROCESS_IO_OPS = "process_io_ops";
private static final String PROCESS_IO_SIZE = "process_io_size";
@@ -154,19 +155,19 @@ public class DiskMetrics implements IMetricSet {
NAME,
diskID);
metricService.createAutoGauge(
- DISK_IO_SECTOR_NUM,
+ DISK_IO_AVG_SIZE,
MetricLevel.IMPORTANT,
diskMetricsManager,
- x -> x.getAvgSectorCountOfEachReadForDisk().getOrDefault(diskID, 0.0).longValue(),
+ x -> x.getAvgSizeOfEachReadForDisk().getOrDefault(diskID, 0.0).longValue(),
TYPE,
READ,
NAME,
diskID);
metricService.createAutoGauge(
- DISK_IO_SECTOR_NUM,
+ DISK_IO_AVG_SIZE,
MetricLevel.IMPORTANT,
diskMetricsManager,
- x -> x.getAvgSectorCountOfEachWriteForDisk().getOrDefault(diskID, 0.0).longValue(),
+ x -> x.getAvgSizeOfEachWriteForDisk().getOrDefault(diskID, 0.0).longValue(),
TYPE,
WRITE,
NAME,
@@ -257,8 +258,8 @@ public class DiskMetrics implements IMetricSet {
metricService.remove(MetricType.AUTO_GAUGE, DISK_IO_TIME, NAME, WRITE, NAME, diskID);
metricService.remove(MetricType.AUTO_GAUGE, DISK_IO_TIME, NAME, AVG_READ, NAME, diskID);
metricService.remove(MetricType.AUTO_GAUGE, DISK_IO_TIME, NAME, AVG_WRITE, NAME, diskID);
- metricService.remove(MetricType.AUTO_GAUGE, DISK_IO_SECTOR_NUM, NAME, READ, NAME, diskID);
- metricService.remove(MetricType.AUTO_GAUGE, DISK_IO_SECTOR_NUM, NAME, WRITE, NAME, diskID);
+ metricService.remove(MetricType.AUTO_GAUGE, DISK_IO_AVG_SIZE, NAME, READ, NAME, diskID);
+ metricService.remove(MetricType.AUTO_GAUGE, DISK_IO_AVG_SIZE, NAME, WRITE, NAME, diskID);
}
// metrics for datanode and config node
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 5ba69f04f9..0a2e7c04c0 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
@@ -19,54 +19,97 @@
package org.apache.iotdb.metrics.metricsets.disk;
+import java.util.Collections;
import java.util.Map;
import java.util.Set;
public interface IDiskMetricsManager {
- Map<String, Long> getReadDataSizeForDisk();
+ default Map<String, Long> getReadDataSizeForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Long> getWriteDataSizeForDisk();
+ default Map<String, Long> getWriteDataSizeForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Long> getReadOperationCountForDisk();
+ default Map<String, Long> getReadOperationCountForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Long> getWriteOperationCountForDisk();
+ default Map<String, Long> getWriteOperationCountForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Long> getMergedWriteOperationForDisk();
+ default Map<String, Long> getMergedWriteOperationForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Long> getMergedReadOperationForDisk();
+ default Map<String, Long> getMergedReadOperationForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Long> getReadCostTimeForDisk();
+ default Map<String, Long> getReadCostTimeForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Long> getWriteCostTimeForDisk();
+ default Map<String, Long> getWriteCostTimeForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Long> getIoUtilsPercentage();
+ default Map<String, Long> getIoUtilsPercentage() {
+ return Collections.emptyMap();
+ }
- Map<String, Double> getAvgReadCostTimeOfEachOpsForDisk();
+ default Map<String, Double> getAvgReadCostTimeOfEachOpsForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Double> getAvgWriteCostTimeOfEachOpsForDisk();
+ default Map<String, Double> getAvgWriteCostTimeOfEachOpsForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Double> getAvgSectorCountOfEachReadForDisk();
+ default Map<String, Double> getAvgSizeOfEachReadForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Double> getAvgSectorCountOfEachWriteForDisk();
+ default Map<String, Double> getAvgSizeOfEachWriteForDisk() {
+ return Collections.emptyMap();
+ }
- Map<String, Long> getQueueSizeForDisk();
+ default Map<String, Long> getQueueSizeForDisk() {
+ return Collections.emptyMap();
+ }
- long getActualReadDataSizeForProcess();
+ default long getActualReadDataSizeForProcess() {
+ return 0L;
+ }
- long getActualWriteDataSizeForProcess();
+ default long getActualWriteDataSizeForProcess() {
+ return 0L;
+ }
- long getReadOpsCountForProcess();
+ default long getReadOpsCountForProcess() {
+ return 0L;
+ }
- long getWriteOpsCountForProcess();
+ default long getWriteOpsCountForProcess() {
+ return 0L;
+ }
- long getAttemptReadSizeForProcess();
+ default long getAttemptReadSizeForProcess() {
+ return 0L;
+ }
- long getAttemptWriteSizeForProcess();
+ default long getAttemptWriteSizeForProcess() {
+ return 0L;
+ }
- Set<String> getDiskIds();
+ default Set<String> getDiskIds() {
+ return Collections.emptySet();
+ }
/** Return different implementation of DiskMetricsManager according to OS type. */
- public static IDiskMetricsManager getDiskMetricsManager() {
+ static IDiskMetricsManager getDiskMetricsManager() {
String os = System.getProperty("os.name").toLowerCase();
if (os.startsWith("windows")) {
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 0e29ce95b8..80fd10f7c8 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
@@ -29,7 +29,6 @@ import java.io.IOException;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@@ -59,6 +58,9 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
@SuppressWarnings("squid:S1075")
private static final String DISK_ID_PATH = "/sys/block";
+ @SuppressWarnings("squid:S1075")
+ private static final String DISK_SECTOR_SIZE_PATH = "/sys/block/%s/queue/hw_sector_size";
+
private final String processIoStatusPath;
private static final int DISK_ID_OFFSET = 3;
private static final int DISK_READ_COUNT_OFFSET = 4;
@@ -69,31 +71,37 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
private static final int DISK_MERGED_WRITE_COUNT_OFFSET = 9;
private static final int DISK_SECTOR_WRITE_COUNT_OFFSET = 10;
private static final int DISK_WRITE_TIME_COST_OFFSET = 11;
- private static final int DISK_QUEUE_SIZE_OFFSET = 12;
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 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;
private long updateInterval = 1L;
// Disk IO status structure
- private final Map<String, Long> lastReadOperationCountForDisk = new HashMap<>();
- private final Map<String, Long> lastWriteOperationCountForDisk = new HashMap<>();
- private final Map<String, Long> lastReadTimeCostForDisk = new HashMap<>();
- private final Map<String, Long> lastWriteTimeCostForDisk = new HashMap<>();
- private final Map<String, Long> lastMergedReadCountForDisk = new HashMap<>();
- private final Map<String, Long> lastMergedWriteCountForDisk = new HashMap<>();
- private final Map<String, Long> lastReadSectorCountForDisk = new HashMap<>();
- private final Map<String, Long> lastWriteSectorCountForDisk = new HashMap<>();
- private final Map<String, Long> queueSizeMap = new HashMap<>();
- private final Map<String, Long> lastIoBusyTimeForDisk = new HashMap<>();
- private final Map<String, Long> incrementReadOperationCountForDisk = new HashMap<>();
- private final Map<String, Long> incrementWriteOperationCountForDisk = new HashMap<>();
- private final Map<String, Long> incrementReadTimeCostForDisk = new HashMap<>();
- private final Map<String, Long> incrementWriteTimeCostForDisk = new HashMap<>();
- private final Map<String, Long> incrementReadSectorCountForDisk = new HashMap<>();
- private final Map<String, Long> incrementWriteSectorCountForDisk = new HashMap<>();
- private final Map<String, Long> incrementIoBusyTimeForDisk = new HashMap<>();
+ private final Map<String, Long> lastReadOperationCountForDisk;
+ private final Map<String, Long> lastWriteOperationCountForDisk;
+ private final Map<String, Long> lastReadTimeCostForDisk;
+ private final Map<String, Long> lastWriteTimeCostForDisk;
+ private final Map<String, Long> lastMergedReadCountForDisk;
+ private final Map<String, Long> lastMergedWriteCountForDisk;
+ private final Map<String, Long> lastReadSectorCountForDisk;
+ private final Map<String, Long> lastWriteSectorCountForDisk;
+ private final Map<String, Long> lastIoBusyTimeForDisk;
+ private final Map<String, Long> lastTimeInQueueForDisk;
+ private final Map<String, Long> incrementReadOperationCountForDisk;
+ private final Map<String, Long> incrementWriteOperationCountForDisk;
+ private final Map<String, Long> incrementReadTimeCostForDisk;
+ private final Map<String, Long> incrementWriteTimeCostForDisk;
+ private final Map<String, Long> incrementReadSectorCountForDisk;
+ private final Map<String, Long> incrementWriteSectorCountForDisk;
+ private final Map<String, Long> incrementIoBusyTimeForDisk;
+ private final Map<String, Long> incrementTimeInQueueForDisk;
// Process IO status structure
private long lastReallyReadSizeForProcess = 0L;
@@ -104,19 +112,39 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
private long lastWriteOpsCountForProcess = 0L;
public LinuxDiskMetricsManager() {
- super();
processIoStatusPath =
String.format(
"/proc/%s/io", MetricConfigDescriptor.getInstance().getMetricConfig().getPid());
+ collectDiskId();
+ diskSectorSizeMap = new HashMap<>(diskIdSet.size());
+ collectDiskInfo();
+ lastReadOperationCountForDisk = new HashMap<>(diskIdSet.size());
+ lastWriteOperationCountForDisk = new HashMap<>(diskIdSet.size());
+ lastReadTimeCostForDisk = new HashMap<>(diskIdSet.size());
+ lastWriteTimeCostForDisk = new HashMap<>(diskIdSet.size());
+ lastMergedReadCountForDisk = new HashMap<>(diskIdSet.size());
+ lastMergedWriteCountForDisk = new HashMap<>(diskIdSet.size());
+ lastReadSectorCountForDisk = new HashMap<>(diskIdSet.size());
+ lastWriteSectorCountForDisk = new HashMap<>(diskIdSet.size());
+ lastIoBusyTimeForDisk = new HashMap<>(diskIdSet.size());
+ lastTimeInQueueForDisk = new HashMap<>(diskIdSet.size());
+ incrementReadOperationCountForDisk = new HashMap<>(diskIdSet.size());
+ incrementWriteOperationCountForDisk = new HashMap<>(diskIdSet.size());
+ incrementReadTimeCostForDisk = new HashMap<>(diskIdSet.size());
+ incrementWriteTimeCostForDisk = new HashMap<>(diskIdSet.size());
+ incrementReadSectorCountForDisk = new HashMap<>(diskIdSet.size());
+ incrementWriteSectorCountForDisk = new HashMap<>(diskIdSet.size());
+ incrementIoBusyTimeForDisk = new HashMap<>(diskIdSet.size());
+ incrementTimeInQueueForDisk = new HashMap<>(diskIdSet.size());
}
@Override
public Map<String, Long> getReadDataSizeForDisk() {
checkUpdate();
- Map<String, Long> readDataMap = new HashMap<>();
+ Map<String, Long> readDataMap = new HashMap<>(diskIdSet.size());
for (Map.Entry<String, Long> entry : lastReadSectorCountForDisk.entrySet()) {
- // the data size in each sector is 512 byte
- readDataMap.put(entry.getKey(), entry.getValue() * 512 / 1024);
+ int sectorSize = diskSectorSizeMap.getOrDefault(entry.getKey(), DEFAULT_SECTOR_SIZE);
+ readDataMap.put(entry.getKey(), entry.getValue() * sectorSize / BYTES_PER_KB);
}
return readDataMap;
}
@@ -124,10 +152,10 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
@Override
public Map<String, Long> getWriteDataSizeForDisk() {
checkUpdate();
- Map<String, Long> writeDataMap = new HashMap<>();
+ Map<String, Long> writeDataMap = new HashMap<>(diskIdSet.size());
for (Map.Entry<String, Long> entry : lastWriteSectorCountForDisk.entrySet()) {
- // the data size in each sector is 512 byte
- writeDataMap.put(entry.getKey(), entry.getValue() * 512 / 1024);
+ int sectorSize = diskSectorSizeMap.getOrDefault(entry.getKey(), DEFAULT_SECTOR_SIZE);
+ writeDataMap.put(entry.getKey(), entry.getValue() * sectorSize / BYTES_PER_KB);
}
return writeDataMap;
}
@@ -155,63 +183,73 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
@Override
public Map<String, Long> getIoUtilsPercentage() {
- Map<String, Long> utilsMap = new HashMap<>();
+ Map<String, Long> utilsMap = new HashMap<>(diskIdSet.size());
for (Map.Entry<String, Long> entry : incrementIoBusyTimeForDisk.entrySet()) {
- utilsMap.put(entry.getKey(), (long) (entry.getValue() * 10000.0 / updateInterval));
+ // 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));
}
return utilsMap;
}
@Override
public Map<String, Double> getAvgReadCostTimeOfEachOpsForDisk() {
- Map<String, Double> avgReadTimeCostMap = new HashMap<>();
+ 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
avgReadTimeCostMap.put(
- readCostEntry.getKey(), (double) readCostEntry.getValue() / writeOpsCount * 1000_000.0);
+ readCostEntry.getKey(),
+ (double) readCostEntry.getValue() / writeOpsCount * MS_TO_NS_FACTOR);
}
return avgReadTimeCostMap;
}
@Override
public Map<String, Double> getAvgWriteCostTimeOfEachOpsForDisk() {
- Map<String, Double> avgWriteTimeCostMap = new HashMap<>();
+ Map<String, Double> avgWriteTimeCostMap = new HashMap<>(diskIdSet.size());
for (Map.Entry<String, Long> writeCostEntry : incrementWriteTimeCostForDisk.entrySet()) {
long writeOpsCount =
incrementWriteOperationCountForDisk.getOrDefault(writeCostEntry.getKey(), 1L);
// convert to nanosecond
avgWriteTimeCostMap.put(
- writeCostEntry.getKey(), (double) writeCostEntry.getValue() / writeOpsCount * 1000_000.0);
+ writeCostEntry.getKey(),
+ (double) writeCostEntry.getValue() / writeOpsCount * MS_TO_NS_FACTOR);
}
return avgWriteTimeCostMap;
}
@Override
- public Map<String, Double> getAvgSectorCountOfEachReadForDisk() {
- Map<String, Double> avgSectorSizeOfRead = new HashMap<>();
+ public Map<String, Double> getAvgSizeOfEachReadForDisk() {
+ Map<String, Double> avgSizeOfReadMap = new HashMap<>(diskIdSet.size());
for (Map.Entry<String, Long> readSectorSizeEntry : incrementReadSectorCountForDisk.entrySet()) {
long readOpsCount =
incrementReadOperationCountForDisk.getOrDefault(readSectorSizeEntry.getKey(), 1L);
- avgSectorSizeOfRead.put(
- readSectorSizeEntry.getKey(), ((double) readSectorSizeEntry.getValue()) / readOpsCount);
+ int sectorSize =
+ diskSectorSizeMap.getOrDefault(readSectorSizeEntry.getKey(), DEFAULT_SECTOR_SIZE);
+ avgSizeOfReadMap.put(
+ readSectorSizeEntry.getKey(),
+ ((double) readSectorSizeEntry.getValue()) * sectorSize / readOpsCount);
}
- return avgSectorSizeOfRead;
+ return avgSizeOfReadMap;
}
@Override
- public Map<String, Double> getAvgSectorCountOfEachWriteForDisk() {
- Map<String, Double> avgSectorSizeOfWrite = new HashMap<>();
+ public Map<String, Double> getAvgSizeOfEachWriteForDisk() {
+ Map<String, Double> avgSizeOfWriteMap = new HashMap<>(diskIdSet.size());
for (Map.Entry<String, Long> writeSectorSizeEntry :
incrementWriteSectorCountForDisk.entrySet()) {
long writeOpsCount =
incrementWriteOperationCountForDisk.getOrDefault(writeSectorSizeEntry.getKey(), 1L);
- avgSectorSizeOfWrite.put(
+ int sectorSize =
+ diskSectorSizeMap.getOrDefault(writeSectorSizeEntry.getKey(), DEFAULT_SECTOR_SIZE);
+ avgSizeOfWriteMap.put(
writeSectorSizeEntry.getKey(),
- ((double) writeSectorSizeEntry.getValue()) / writeOpsCount);
+ ((double) writeSectorSizeEntry.getValue()) * sectorSize / writeOpsCount);
}
- return avgSectorSizeOfWrite;
+ return avgSizeOfWriteMap;
}
@Override
@@ -226,17 +264,25 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
@Override
public Map<String, Long> getQueueSizeForDisk() {
- return queueSizeMap;
+ Map<String, Long> 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));
+ }
+ return avgQueueSizeMap;
}
@Override
public long getActualReadDataSizeForProcess() {
- return lastReallyReadSizeForProcess / 1024;
+ return lastReallyReadSizeForProcess / BYTES_PER_KB;
}
@Override
public long getActualWriteDataSizeForProcess() {
- return lastReallyWriteSizeForProcess / 1024;
+ return lastReallyWriteSizeForProcess / BYTES_PER_KB;
}
@Override
@@ -251,19 +297,23 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
@Override
public long getAttemptReadSizeForProcess() {
- return (long) (lastAttemptReadSizeForProcess / 1024.0);
+ return (long) ((double) (lastAttemptReadSizeForProcess) / BYTES_PER_KB);
}
@Override
public long getAttemptWriteSizeForProcess() {
- return (long) (lastAttemptWriteSizeForProcess / 1024.0);
+ return (long) (((double) lastAttemptWriteSizeForProcess) / BYTES_PER_KB);
}
@Override
public Set<String> getDiskIds() {
+ return diskIdSet;
+ }
+
+ private void collectDiskId() {
File diskIdFolder = new File(DISK_ID_PATH);
if (!diskIdFolder.exists()) {
- return Collections.emptySet();
+ return;
}
diskIdSet =
new ArrayList<>(Arrays.asList(Objects.requireNonNull(diskIdFolder.listFiles())))
@@ -271,7 +321,26 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
.filter(x -> !x.getName().startsWith("loop") && !x.getName().startsWith("ram"))
.map(File::getName)
.collect(Collectors.toSet());
- return diskIdSet;
+ }
+
+ private void collectDiskInfo() {
+ for (String diskId : diskIdSet) {
+ String diskSectorSizePath = String.format(DISK_SECTOR_SIZE_PATH, diskId);
+ File diskSectorSizeFile = new File(diskSectorSizePath);
+ try (Scanner scanner = new Scanner(Files.newInputStream(diskSectorSizeFile.toPath()))) {
+ if (scanner.hasNext()) {
+ int sectorSize = Integer.parseInt(scanner.nextLine());
+ diskSectorSizeMap.put(diskId, sectorSize);
+ } else {
+ // use DEFAULT_SECTOR_SIZE byte as default value
+ diskSectorSizeMap.put(diskId, DEFAULT_SECTOR_SIZE);
+ }
+ } catch (IOException e) {
+ log.warn("Failed to get the sector size of {}", diskId, e);
+ // use DEFAULT_SECTOR_SIZE bytes as default value
+ diskSectorSizeMap.put(diskId, DEFAULT_SECTOR_SIZE);
+ }
+ }
}
private void updateInfo() {
@@ -305,8 +374,8 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
DISK_SECTOR_WRITE_COUNT_OFFSET,
DISK_READ_TIME_OFFSET,
DISK_WRITE_TIME_COST_OFFSET,
- DISK_QUEUE_SIZE_OFFSET,
- DISK_IO_TOTAL_TIME_OFFSET
+ DISK_IO_TOTAL_TIME_OFFSET,
+ DISK_TIME_IN_QUEUE_OFFSET
};
Map[] lastMapArray = {
lastReadOperationCountForDisk,
@@ -317,8 +386,8 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
lastWriteSectorCountForDisk,
lastReadTimeCostForDisk,
lastWriteTimeCostForDisk,
- queueSizeMap,
- lastIoBusyTimeForDisk
+ lastIoBusyTimeForDisk,
+ lastTimeInQueueForDisk
};
Map[] incrementMapArray = {
incrementReadOperationCountForDisk,
@@ -329,8 +398,8 @@ public class LinuxDiskMetricsManager implements IDiskMetricsManager {
incrementWriteSectorCountForDisk,
incrementReadTimeCostForDisk,
incrementWriteTimeCostForDisk,
- null,
- incrementIoBusyTimeForDisk
+ incrementIoBusyTimeForDisk,
+ incrementTimeInQueueForDisk
};
for (int index = 0, length = offsetArray.length; index < length; ++index) {
updateSingleDiskInfo(
diff --git a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/MacDiskMetricsManager.java b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/MacDiskMetricsManager.java
index 7b212ac119..f5efff5368 100644
--- a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/MacDiskMetricsManager.java
+++ b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/MacDiskMetricsManager.java
@@ -19,119 +19,5 @@
package org.apache.iotdb.metrics.metricsets.disk;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
/** Disk Metrics Manager for macOS, not implemented yet. */
-public class MacDiskMetricsManager implements IDiskMetricsManager {
-
- public MacDiskMetricsManager() {
- super();
- }
-
- @Override
- public Map<String, Long> getReadDataSizeForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getWriteDataSizeForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getReadOperationCountForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getWriteOperationCountForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getReadCostTimeForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getWriteCostTimeForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getIoUtilsPercentage() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Double> getAvgReadCostTimeOfEachOpsForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Double> getAvgWriteCostTimeOfEachOpsForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Double> getAvgSectorCountOfEachReadForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Double> getAvgSectorCountOfEachWriteForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getQueueSizeForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getMergedWriteOperationForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getMergedReadOperationForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public long getActualReadDataSizeForProcess() {
- return 0;
- }
-
- @Override
- public long getActualWriteDataSizeForProcess() {
- return 0;
- }
-
- @Override
- public long getReadOpsCountForProcess() {
- return 0;
- }
-
- @Override
- public long getWriteOpsCountForProcess() {
- return 0;
- }
-
- @Override
- public long getAttemptReadSizeForProcess() {
- return 0;
- }
-
- @Override
- public long getAttemptWriteSizeForProcess() {
- return 0;
- }
-
- @Override
- public Set<String> getDiskIds() {
- return Collections.emptySet();
- }
-}
+public class MacDiskMetricsManager implements IDiskMetricsManager {}
diff --git a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/WindowsDiskMetricsManager.java b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/WindowsDiskMetricsManager.java
index 0668ba49b0..975576ac90 100644
--- a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/WindowsDiskMetricsManager.java
+++ b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/disk/WindowsDiskMetricsManager.java
@@ -19,119 +19,5 @@
package org.apache.iotdb.metrics.metricsets.disk;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
/** Disk Metrics Manager for Windows system, not implemented yet. */
-public class WindowsDiskMetricsManager implements IDiskMetricsManager {
-
- public WindowsDiskMetricsManager() {
- super();
- }
-
- @Override
- public Map<String, Long> getReadDataSizeForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getWriteDataSizeForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getReadOperationCountForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getWriteOperationCountForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getMergedWriteOperationForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getMergedReadOperationForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getReadCostTimeForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getWriteCostTimeForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getIoUtilsPercentage() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Double> getAvgReadCostTimeOfEachOpsForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Double> getAvgWriteCostTimeOfEachOpsForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Double> getAvgSectorCountOfEachReadForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Double> getAvgSectorCountOfEachWriteForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public Map<String, Long> getQueueSizeForDisk() {
- return Collections.emptyMap();
- }
-
- @Override
- public long getActualReadDataSizeForProcess() {
- return 0;
- }
-
- @Override
- public long getActualWriteDataSizeForProcess() {
- return 0;
- }
-
- @Override
- public long getReadOpsCountForProcess() {
- return 0;
- }
-
- @Override
- public long getWriteOpsCountForProcess() {
- return 0;
- }
-
- @Override
- public long getAttemptReadSizeForProcess() {
- return 0;
- }
-
- @Override
- public long getAttemptWriteSizeForProcess() {
- return 0;
- }
-
- @Override
- public Set<String> getDiskIds() {
- return Collections.emptySet();
- }
-}
+public class WindowsDiskMetricsManager implements IDiskMetricsManager {}
diff --git a/server/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java b/server/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java
index 1bb74f4851..453f4f9933 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java
@@ -19,6 +19,7 @@
package org.apache.iotdb.db.service.metrics;
+import org.apache.iotdb.commons.conf.IoTDBConstant;
import org.apache.iotdb.commons.service.metric.MetricService;
import org.apache.iotdb.db.mpp.metric.DataExchangeCostMetricSet;
import org.apache.iotdb.db.mpp.metric.DataExchangeCountMetricSet;
@@ -40,7 +41,7 @@ public class DataNodeMetricsHelper {
MetricService.getInstance().addMetricSet(new CompactionMetrics());
MetricService.getInstance().addMetricSet(new ProcessMetrics());
MetricService.getInstance().addMetricSet(new SystemMetrics(true));
- MetricService.getInstance().addMetricSet(new DiskMetrics("DataNode"));
+ MetricService.getInstance().addMetricSet(new DiskMetrics(IoTDBConstant.DN_ROLE));
// bind query related metrics
MetricService.getInstance().addMetricSet(new QueryPlanCostMetricSet());