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 2022/12/18 05:08:49 UTC
[iotdb] branch rel/1.0 updated: Add the statistics of flush point (#8494)
This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch rel/1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/1.0 by this push:
new 93a6e7a948 Add the statistics of flush point (#8494)
93a6e7a948 is described below
commit 93a6e7a9482f4d27184e354e32f677d675da6db2
Author: ZhangHongYin <46...@users.noreply.github.com>
AuthorDate: Sun Dec 18 13:08:43 2022 +0800
Add the statistics of flush point (#8494)
---
docs/UserGuide/Monitor-Alert/Metric-Tool.md | 3 ++-
docs/zh/UserGuide/Monitor-Alert/Metric-Tool.md | 15 +++++++-------
.../iotdb/commons/service/metric/enums/Metric.java | 3 ++-
.../iotdb/commons/service/metric/enums/Tag.java | 3 ++-
.../iotdb/db/engine/flush/MemTableFlushTask.java | 23 +++++++++++++++++++++-
5 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/docs/UserGuide/Monitor-Alert/Metric-Tool.md b/docs/UserGuide/Monitor-Alert/Metric-Tool.md
index 0c3b75ade0..de2302c8b5 100644
--- a/docs/UserGuide/Monitor-Alert/Metric-Tool.md
+++ b/docs/UserGuide/Monitor-Alert/Metric-Tool.md
@@ -119,10 +119,11 @@ Core-level metrics are enabled by default during system operation. The addition
#### 4.2.2. Node
| Metric | Tags | Type | Description |
-| -------- | ------------------------------------------ | --------- | ------------------------------------------------------------- |
+|----------|--------------------------------------------|-----------|---------------------------------------------------------------|
| quantity | name="database" | AutoGauge | The number of database |
| quantity | name="timeSeries" | AutoGauge | The number of timeseries |
| quantity | name="pointsIn" | Counter | The number of write points |
+| points | database="{{database}}", type="flush" | Gauge | The point number of last flushed memtable |
| region | name="total",type="SchemaRegion" | AutoGauge | The total number of SchemaRegion in PartitionTable |
| region | name="total",type="DataRegion" | AutoGauge | The total number of DataRegion in PartitionTable |
| region | name="{{ip}}:{{port}}",type="SchemaRegion" | Gauge | The number of SchemaRegion in PartitionTable of specific node |
diff --git a/docs/zh/UserGuide/Monitor-Alert/Metric-Tool.md b/docs/zh/UserGuide/Monitor-Alert/Metric-Tool.md
index 045b13a8d6..3ffc58ac91 100644
--- a/docs/zh/UserGuide/Monitor-Alert/Metric-Tool.md
+++ b/docs/zh/UserGuide/Monitor-Alert/Metric-Tool.md
@@ -121,13 +121,14 @@ Core 级别的监控指标在系统运行中默认开启,每一个 Core 级别
| cluster_node_status | name="{{ip}}:{{port}}",type="ConfigNode/DataNode" | Gauge | 节点的状态,0=Unkonwn 1=online |
#### 4.2.2. 节点统计
-| Metric | Tags | Type | Description |
-| -------- | ------------------------------------------ | --------- | ------------------------------------ |
-| quantity | name="database" | AutoGauge | 系统数据库数量 |
-| quantity | name="timeSeries" | AutoGauge | 系统时间序列数量 |
-| quantity | name="pointsIn" | Counter | 系统累计写入点数 |
-| region | name="total",type="SchemaRegion" | AutoGauge | 分区表中 SchemaRegion 总数量 |
-| region | name="total",type="DataRegion" | AutoGauge | 分区表中 DataRegion 总数量 |
+| Metric | Tags | Type | Description |
+| -------- | ------------------------------------------ | --------- |--------------------------|
+| quantity | name="database" | AutoGauge | 系统数据库数量 |
+| quantity | name="timeSeries" | AutoGauge | 系统时间序列数量 |
+| quantity | name="pointsIn" | Counter | 系统累计写入点数 |
+| points | database="{{database}}", type="flush" | Gauge | 最新一个刷盘的memtale的点数 |
+| region | name="total",type="SchemaRegion" | AutoGauge | 分区表中 SchemaRegion 总数量 |
+| region | name="total",type="DataRegion" | AutoGauge | 分区表中 DataRegion 总数量 |
| region | name="{{ip}}:{{port}}",type="SchemaRegion" | Gauge | 分区表中对应节点上 DataRegion 总数量 |
| region | name="{{ip}}:{{port}}",type="DataRegion" | Gauge | 分区表中对应节点上 DataRegion 总数量 |
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java b/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java
index fc534ef595..16bf0d92b0 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java
@@ -61,7 +61,8 @@ public enum Metric {
THRIFT_CONNECTIONS,
THRIFT_ACTIVE_THREADS,
IOT_CONSENSUS,
- STAGE;
+ STAGE,
+ POINTS;
@Override
public String toString() {
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Tag.java b/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Tag.java
index 1b02b0161c..24bc55a757 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Tag.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Tag.java
@@ -23,7 +23,8 @@ public enum Tag {
TYPE,
NAME,
REGION,
- STATUS;
+ STATUS,
+ DATABASE;
@Override
public String toString() {
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java b/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java
index 9b561e7931..196fc3d866 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/flush/MemTableFlushTask.java
@@ -30,6 +30,8 @@ import org.apache.iotdb.db.engine.memtable.IWritableMemChunkGroup;
import org.apache.iotdb.db.exception.runtime.FlushRunTimeException;
import org.apache.iotdb.db.metadata.idtable.entry.IDeviceID;
import org.apache.iotdb.db.rescon.SystemInfo;
+import org.apache.iotdb.metrics.config.MetricConfigDescriptor;
+import org.apache.iotdb.metrics.utils.IoTDBMetricsUtils;
import org.apache.iotdb.metrics.utils.MetricLevel;
import org.apache.iotdb.tsfile.write.chunk.IChunkWriter;
import org.apache.iotdb.tsfile.write.writer.RestorableTsFileIOWriter;
@@ -251,7 +253,26 @@ public class MemTableFlushTask {
Thread.currentThread().interrupt();
}
- LOGGER.debug(
+ if (!storageGroup.startsWith(IoTDBMetricsUtils.DATABASE)
+ && MetricLevel.higherOrEqual(
+ MetricConfigDescriptor.getInstance().getMetricConfig().getMetricLevel(),
+ MetricLevel.IMPORTANT)) {
+ int lastIndex = storageGroup.lastIndexOf("-");
+ if (lastIndex == -1) {
+ lastIndex = storageGroup.length();
+ }
+ MetricService.getInstance()
+ .gaugeWithInternalReport(
+ memTable.getTotalPointsNum(),
+ Metric.POINTS.toString(),
+ MetricLevel.IMPORTANT,
+ Tag.DATABASE.toString(),
+ storageGroup.substring(0, lastIndex),
+ Tag.TYPE.toString(),
+ "flush");
+ }
+
+ LOGGER.info(
"Database {}, flushing memtable {} into disk: Encoding data cost " + "{} ms.",
storageGroup,
writer.getFile().getName(),