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/02/10 09:27:38 UTC

[iotdb] branch IOTDB-5517 created (now ed9d1d7078)

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

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


      at ed9d1d7078 define the interface

This branch includes the following new commits:

     new ed9d1d7078 define the interface

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: define the interface

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ed9d1d7078eee09d7e196b241470e17a0aad564b
Author: LiuXuxin <li...@outlook.com>
AuthorDate: Fri Feb 10 17:27:09 2023 +0800

    define the interface
---
 .../iotdb/db/service/metrics/DiskMetrics.java      |  32 +++++
 .../metrics/io/AbstractDiskMetricsManager.java     |  88 ++++++++++++++
 .../metrics/io/LinuxDiskMetricsManager.java        | 134 +++++++++++++++++++++
 .../service/metrics/io/MacDiskMetricsManager.java  | 134 +++++++++++++++++++++
 .../metrics/io/WindowsDiskMetricsManager.java      | 134 +++++++++++++++++++++
 5 files changed, 522 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/service/metrics/DiskMetrics.java b/server/src/main/java/org/apache/iotdb/db/service/metrics/DiskMetrics.java
new file mode 100644
index 0000000000..a0f11ee28a
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/service/metrics/DiskMetrics.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.service.metrics;
+
+import org.apache.iotdb.metrics.AbstractMetricService;
+import org.apache.iotdb.metrics.metricsets.IMetricSet;
+
+public class DiskMetrics implements IMetricSet {
+
+  @Override
+  public void bindTo(AbstractMetricService metricService) {}
+
+  @Override
+  public void unbindFrom(AbstractMetricService metricService) {}
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/service/metrics/io/AbstractDiskMetricsManager.java b/server/src/main/java/org/apache/iotdb/db/service/metrics/io/AbstractDiskMetricsManager.java
new file mode 100644
index 0000000000..c26153d5f0
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/service/metrics/io/AbstractDiskMetricsManager.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.service.metrics.io;
+
+import java.util.Map;
+
+public abstract class AbstractDiskMetricsManager {
+  public abstract Map<String, Double> getReadOpsRateForDisk();
+
+  public abstract Map<String, Double> getWriteOpsRateForDisk();
+
+  public abstract Map<String, Double> getReadThroughputForDisk();
+
+  public abstract Map<String, Double> getWriteThroughPutForDisk();
+
+  public abstract Map<String, Long> getReadDataSizeForDisk();
+
+  public abstract Map<String, Long> getWriteDataSizeForDisk();
+
+  public abstract Map<String, Long> getReadCostTimeForDisk();
+
+  public abstract Map<String, Long> getWriteCostTimeForDisk();
+
+  public abstract Map<String, Double> getAvgReadCostTimeOfEachOpsForDisk();
+
+  public abstract Map<String, Double> getAvgWriteCostTimeOfEachOpsForDisk();
+
+  public abstract Map<String, Double> getAvgSectorSizeOfEachReadForDisk();
+
+  public abstract Map<String, Double> getAvgSectorSizeOfEachWriteForDisk();
+
+  public abstract long getReadDataSizeForDataNode();
+
+  public abstract long getWriteDataSizeForDataNode();
+
+  public abstract double getReadThroughputForDataNode();
+
+  public abstract double getWriteThroughputForDataNode();
+
+  public abstract long getReadOpsRateForDataNode();
+
+  public abstract long getWriteOpsRateForDataNode();
+
+  public abstract long getReadCostTimeForDataNode();
+
+  public abstract long getWriteCostTimeForDataNode();
+
+  public abstract long getAvgReadCostTimeOfEachOpsForDataNode();
+
+  public abstract long getAvgWriteCostTimeOfEachOpsForDataNode();
+
+  /**
+   * Return different implementation of DiskMetricsManager according to OS type.
+   *
+   * @return
+   */
+  public static AbstractDiskMetricsManager getDiskMetricsManager() {
+    String os = System.getProperty("os.name");
+    if (os == null) {
+      throw new RuntimeException("Cannot get the os type");
+    }
+
+    if (os.startsWith("windows")) {
+      return new WindowsDiskMetricsManager();
+    } else if (os.startsWith("linux")) {
+      return new LinuxDiskMetricsManager();
+    } else {
+      return new MacDiskMetricsManager();
+    }
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/service/metrics/io/LinuxDiskMetricsManager.java b/server/src/main/java/org/apache/iotdb/db/service/metrics/io/LinuxDiskMetricsManager.java
new file mode 100644
index 0000000000..c6d7a51dc0
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/service/metrics/io/LinuxDiskMetricsManager.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.service.metrics.io;
+
+import java.util.Map;
+
+public class LinuxDiskMetricsManager extends AbstractDiskMetricsManager {
+  @Override
+  public Map<String, Double> getReadOpsRateForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getWriteOpsRateForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getReadThroughputForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getWriteThroughPutForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getReadDataSizeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getWriteDataSizeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getReadCostTimeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getWriteCostTimeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgReadCostTimeOfEachOpsForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgWriteCostTimeOfEachOpsForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgSectorSizeOfEachReadForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgSectorSizeOfEachWriteForDisk() {
+    return null;
+  }
+
+  @Override
+  public long getReadDataSizeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getWriteDataSizeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public double getReadThroughputForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public double getWriteThroughputForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getReadOpsRateForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getWriteOpsRateForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getReadCostTimeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getWriteCostTimeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getAvgReadCostTimeOfEachOpsForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getAvgWriteCostTimeOfEachOpsForDataNode() {
+    return 0;
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/service/metrics/io/MacDiskMetricsManager.java b/server/src/main/java/org/apache/iotdb/db/service/metrics/io/MacDiskMetricsManager.java
new file mode 100644
index 0000000000..7bc126376f
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/service/metrics/io/MacDiskMetricsManager.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.service.metrics.io;
+
+import java.util.Map;
+
+public class MacDiskMetricsManager extends AbstractDiskMetricsManager {
+  @Override
+  public Map<String, Double> getReadOpsRateForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getWriteOpsRateForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getReadThroughputForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getWriteThroughPutForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getReadDataSizeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getWriteDataSizeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getReadCostTimeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getWriteCostTimeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgReadCostTimeOfEachOpsForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgWriteCostTimeOfEachOpsForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgSectorSizeOfEachReadForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgSectorSizeOfEachWriteForDisk() {
+    return null;
+  }
+
+  @Override
+  public long getReadDataSizeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getWriteDataSizeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public double getReadThroughputForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public double getWriteThroughputForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getReadOpsRateForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getWriteOpsRateForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getReadCostTimeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getWriteCostTimeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getAvgReadCostTimeOfEachOpsForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getAvgWriteCostTimeOfEachOpsForDataNode() {
+    return 0;
+  }
+}
diff --git a/server/src/main/java/org/apache/iotdb/db/service/metrics/io/WindowsDiskMetricsManager.java b/server/src/main/java/org/apache/iotdb/db/service/metrics/io/WindowsDiskMetricsManager.java
new file mode 100644
index 0000000000..a330fb9d0c
--- /dev/null
+++ b/server/src/main/java/org/apache/iotdb/db/service/metrics/io/WindowsDiskMetricsManager.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.service.metrics.io;
+
+import java.util.Map;
+
+public class WindowsDiskMetricsManager extends AbstractDiskMetricsManager {
+  @Override
+  public Map<String, Double> getReadOpsRateForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getWriteOpsRateForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getReadThroughputForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getWriteThroughPutForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getReadDataSizeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getWriteDataSizeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getReadCostTimeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Long> getWriteCostTimeForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgReadCostTimeOfEachOpsForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgWriteCostTimeOfEachOpsForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgSectorSizeOfEachReadForDisk() {
+    return null;
+  }
+
+  @Override
+  public Map<String, Double> getAvgSectorSizeOfEachWriteForDisk() {
+    return null;
+  }
+
+  @Override
+  public long getReadDataSizeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getWriteDataSizeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public double getReadThroughputForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public double getWriteThroughputForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getReadOpsRateForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getWriteOpsRateForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getReadCostTimeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getWriteCostTimeForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getAvgReadCostTimeOfEachOpsForDataNode() {
+    return 0;
+  }
+
+  @Override
+  public long getAvgWriteCostTimeOfEachOpsForDataNode() {
+    return 0;
+  }
+}