You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ma...@apache.org on 2023/03/12 04:27:10 UTC

[iotdb] branch IOTDB-5663 updated: add dashboard

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

marklau99 pushed a commit to branch IOTDB-5663
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/IOTDB-5663 by this push:
     new 8ccd837719 add dashboard
8ccd837719 is described below

commit 8ccd8377190fe36f1420be484db0fffb60861e66
Author: LiuXuxin <li...@outlook.com>
AuthorDate: Sun Mar 12 12:26:34 2023 +0800

    add dashboard
---
 .../Apache-IoTDB-Network-Dashboard.json            | 444 +++++++++++++++++++++
 .../iotdb/metrics/metricsets/net/NetMetrics.java   |  20 +-
 2 files changed, 455 insertions(+), 9 deletions(-)

diff --git a/docs/UserGuide/Monitor-Alert/Apache-IoTDB-Network-Dashboard.json b/docs/UserGuide/Monitor-Alert/Apache-IoTDB-Network-Dashboard.json
new file mode 100644
index 0000000000..40eb7174d0
--- /dev/null
+++ b/docs/UserGuide/Monitor-Alert/Apache-IoTDB-Network-Dashboard.json
@@ -0,0 +1,444 @@
+{
+  "__inputs": [
+    {
+      "name": "DS_PROMETHEUS",
+      "label": "Prometheus",
+      "description": "",
+      "type": "datasource",
+      "pluginId": "prometheus",
+      "pluginName": "Prometheus"
+    }
+  ],
+  "__elements": {},
+  "__requires": [
+    {
+      "type": "grafana",
+      "id": "grafana",
+      "name": "Grafana",
+      "version": "9.3.6"
+    },
+    {
+      "type": "datasource",
+      "id": "prometheus",
+      "name": "Prometheus",
+      "version": "1.0.0"
+    },
+    {
+      "type": "panel",
+      "id": "timeseries",
+      "name": "Time series",
+      "version": ""
+    }
+  ],
+  "annotations": {
+    "list": [
+      {
+        "builtIn": 1,
+        "datasource": {
+          "type": "grafana",
+          "uid": "-- Grafana --"
+        },
+        "enable": true,
+        "hide": true,
+        "iconColor": "rgba(0, 211, 255, 1)",
+        "name": "Annotations & Alerts",
+        "target": {
+          "limit": 100,
+          "matchAny": false,
+          "tags": [],
+          "type": "dashboard"
+        },
+        "type": "dashboard"
+      }
+    ]
+  },
+  "editable": true,
+  "fiscalYearStartMonth": 0,
+  "graphTooltip": 0,
+  "id": null,
+  "links": [],
+  "liveNow": false,
+  "panels": [
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${DS_PROMETHEUS}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "axisCenteredZero": false,
+            "axisColorMode": "text",
+            "axisLabel": "",
+            "axisPlacement": "auto",
+            "barAlignment": 0,
+            "drawStyle": "line",
+            "fillOpacity": 0,
+            "gradientMode": "none",
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            },
+            "lineInterpolation": "linear",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "auto",
+            "spanNulls": false,
+            "stacking": {
+              "group": "A",
+              "mode": "none"
+            },
+            "thresholdsStyle": {
+              "mode": "off"
+            }
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": null
+              }
+            ]
+          },
+          "unit": "binBps"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 10,
+        "w": 24,
+        "x": 0,
+        "y": 0
+      },
+      "id": 2,
+      "options": {
+        "legend": {
+          "calcs": [
+            "mean"
+          ],
+          "displayMode": "table",
+          "placement": "right",
+          "showLegend": true
+        },
+        "tooltip": {
+          "mode": "multi",
+          "sort": "asc"
+        }
+      },
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "editorMode": "code",
+          "expr": "rate(received_bytes{instance=~\"$instance\", iface_name=~\"$iface\"}[1m])",
+          "legendFormat": "{{iface_name}}-{{type}}",
+          "range": true,
+          "refId": "A"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "editorMode": "code",
+          "expr": "rate(transmitted_bytes{instance=~\"$instance\", iface_name=~\"$iface\"}[1m])",
+          "hide": false,
+          "legendFormat": "{{iface_name}}-{{type}}",
+          "range": true,
+          "refId": "B"
+        }
+      ],
+      "title": "Net Speed",
+      "type": "timeseries"
+    },
+    {
+      "datasource": {
+        "type": "prometheus",
+        "uid": "${DS_PROMETHEUS}"
+      },
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "axisCenteredZero": false,
+            "axisColorMode": "text",
+            "axisLabel": "",
+            "axisPlacement": "auto",
+            "barAlignment": 0,
+            "drawStyle": "line",
+            "fillOpacity": 0,
+            "gradientMode": "none",
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            },
+            "lineInterpolation": "linear",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "auto",
+            "spanNulls": false,
+            "stacking": {
+              "group": "A",
+              "mode": "none"
+            },
+            "thresholdsStyle": {
+              "mode": "off"
+            }
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": null
+              }
+            ]
+          },
+          "unit": "bytes"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 9,
+        "w": 24,
+        "x": 0,
+        "y": 10
+      },
+      "id": 6,
+      "options": {
+        "legend": {
+          "calcs": [
+            "last"
+          ],
+          "displayMode": "table",
+          "placement": "right",
+          "showLegend": true
+        },
+        "tooltip": {
+          "mode": "multi",
+          "sort": "asc"
+        }
+      },
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "editorMode": "code",
+          "expr": "received_bytes{instance=~\"$instance\",iface_name=~\"$iface\"}",
+          "legendFormat": "{{iface_name}}-{{type}}",
+          "range": true,
+          "refId": "A"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "editorMode": "code",
+          "expr": "transmitted_bytes{instance=~\"$instance\",iface_name=~\"$iface\"}",
+          "hide": false,
+          "legendFormat": "{{iface_name}}-{{type}}",
+          "range": true,
+          "refId": "B"
+        }
+      ],
+      "title": "Receive/Transmit Data 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,
+            "drawStyle": "line",
+            "fillOpacity": 0,
+            "gradientMode": "none",
+            "hideFrom": {
+              "legend": false,
+              "tooltip": false,
+              "viz": false
+            },
+            "lineInterpolation": "linear",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "auto",
+            "spanNulls": false,
+            "stacking": {
+              "group": "A",
+              "mode": "none"
+            },
+            "thresholdsStyle": {
+              "mode": "off"
+            }
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": null
+              }
+            ]
+          },
+          "unit": "pps"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 10,
+        "w": 24,
+        "x": 0,
+        "y": 19
+      },
+      "id": 4,
+      "options": {
+        "legend": {
+          "calcs": [
+            "mean"
+          ],
+          "displayMode": "table",
+          "placement": "right",
+          "showLegend": true
+        },
+        "tooltip": {
+          "mode": "multi",
+          "sort": "asc"
+        }
+      },
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "editorMode": "code",
+          "expr": "rate(received_packets{instance=~\"$instance\", iface_name=~\"$iface\"}[1m])",
+          "legendFormat": "{{iface_name}}-{{type}}",
+          "range": true,
+          "refId": "A"
+        },
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "${DS_PROMETHEUS}"
+          },
+          "editorMode": "code",
+          "expr": "rate(transmitted_packets{instance=~\"$instance\", iface_name=~\"$iface\"}[1m])",
+          "hide": false,
+          "legendFormat": "{{iface_name}}-{{type}}",
+          "range": true,
+          "refId": "B"
+        }
+      ],
+      "title": "Packet Speed",
+      "type": "timeseries"
+    }
+  ],
+  "refresh": "15s",
+  "schemaVersion": 37,
+  "style": "dark",
+  "tags": [],
+  "templating": {
+    "list": [
+      {
+        "current": {},
+        "datasource": {
+          "type": "prometheus",
+          "uid": "${DS_PROMETHEUS}"
+        },
+        "definition": "label_values(instance)",
+        "hide": 0,
+        "includeAll": false,
+        "multi": false,
+        "name": "instance",
+        "options": [],
+        "query": {
+          "query": "label_values(instance)",
+          "refId": "StandardVariableQuery"
+        },
+        "refresh": 1,
+        "regex": "",
+        "skipUrlSync": false,
+        "sort": 0,
+        "type": "query"
+      },
+      {
+        "current": {},
+        "datasource": {
+          "type": "prometheus",
+          "uid": "${DS_PROMETHEUS}"
+        },
+        "definition": "label_values(iface_name)",
+        "description": "",
+        "hide": 0,
+        "includeAll": false,
+        "multi": false,
+        "name": "iface",
+        "options": [],
+        "query": {
+          "query": "label_values(iface_name)",
+          "refId": "StandardVariableQuery"
+        },
+        "refresh": 1,
+        "regex": "",
+        "skipUrlSync": false,
+        "sort": 0,
+        "type": "query"
+      }
+    ]
+  },
+  "time": {
+    "from": "now-5m",
+    "to": "now"
+  },
+  "timepicker": {
+    "refresh_intervals": [
+      "15s",
+      "30s",
+      "1m",
+      "5m",
+      "15m",
+      "30m"
+    ]
+  },
+  "timezone": "",
+  "title": "Apache IoTDB Network Dashboard",
+  "uid": "AXEPYc-Vz",
+  "version": 17,
+  "weekStart": ""
+}
\ No newline at end of file
diff --git a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/NetMetrics.java b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/NetMetrics.java
index 0379e81644..1c4115e327 100644
--- a/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/NetMetrics.java
+++ b/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/NetMetrics.java
@@ -37,7 +37,7 @@ public class NetMetrics implements IMetricSet {
   private static final String TRANSMITTED_PACKETS = "transmitted_packets";
 
   private static final String TYPE = "type";
-  private static final String NAME = "name";
+  private static final String IFACE_NAME = "iface_name";
   private static final String RECEIVE = "receive";
   private static final String TRANSMIT = "transmit";
 
@@ -57,7 +57,7 @@ public class NetMetrics implements IMetricSet {
           x -> x.getReceivedByte().get(iFace),
           TYPE,
           RECEIVE,
-          NAME,
+          IFACE_NAME,
           iFace);
       metricService.createAutoGauge(
           TRANSMITTED_BYTES,
@@ -66,7 +66,7 @@ public class NetMetrics implements IMetricSet {
           x -> x.getTransmittedBytes().get(iFace),
           TYPE,
           TRANSMIT,
-          NAME,
+          IFACE_NAME,
           iFace);
       metricService.createAutoGauge(
           RECEIVED_PACKETS,
@@ -75,7 +75,7 @@ public class NetMetrics implements IMetricSet {
           x -> x.getReceivedPackets().get(iFace),
           TYPE,
           RECEIVE,
-          NAME,
+          IFACE_NAME,
           iFace);
       metricService.createAutoGauge(
           TRANSMITTED_PACKETS,
@@ -84,7 +84,7 @@ public class NetMetrics implements IMetricSet {
           x -> x.getTransmittedPackets().get(iFace),
           TYPE,
           TRANSMIT,
-          NAME,
+          IFACE_NAME,
           iFace);
     }
   }
@@ -93,10 +93,12 @@ public class NetMetrics implements IMetricSet {
   public void unbindFrom(AbstractMetricService metricService) {
     Set<String> iFaceSet = netMetricManager.getIfaceSet();
     for (String iFace : iFaceSet) {
-      metricService.remove(MetricType.AUTO_GAUGE, RECEIVED_BYTES, TYPE, RECEIVE, NAME, iFace);
-      metricService.remove(MetricType.AUTO_GAUGE, TRANSMIT, TYPE, TRANSMIT, NAME, iFace);
-      metricService.remove(MetricType.AUTO_GAUGE, RECEIVED_PACKETS, TYPE, RECEIVE, NAME, iFace);
-      metricService.remove(MetricType.AUTO_GAUGE, TRANSMITTED_PACKETS, TYPE, TRANSMIT, NAME, iFace);
+      metricService.remove(MetricType.AUTO_GAUGE, RECEIVED_BYTES, TYPE, RECEIVE, IFACE_NAME, iFace);
+      metricService.remove(MetricType.AUTO_GAUGE, TRANSMIT, TYPE, TRANSMIT, IFACE_NAME, iFace);
+      metricService.remove(
+          MetricType.AUTO_GAUGE, RECEIVED_PACKETS, TYPE, RECEIVE, IFACE_NAME, iFace);
+      metricService.remove(
+          MetricType.AUTO_GAUGE, TRANSMITTED_PACKETS, TYPE, TRANSMIT, IFACE_NAME, iFace);
     }
   }
 }