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 5c23a355579 Add flush cause metric (#12803)
5c23a355579 is described below
commit 5c23a355579257277303443a5895be556e2e0fca
Author: Haonan <[email protected]>
AuthorDate: Wed Jun 26 09:53:34 2024 +0800
Add flush cause metric (#12803)
* Add flush metric
* fix review
---
.../iotdb/db/service/metrics/WritingMetrics.java | 186 ++++++++++++++-------
.../iotdb/db/storageengine/StorageEngine.java | 6 -
.../db/storageengine/dataregion/DataRegion.java | 18 +-
.../dataregion/memtable/TsFileProcessor.java | 3 +-
.../storageengine/dataregion/wal/node/WALNode.java | 2 +-
.../iotdb/metrics/core/type/IoTDBCounter.java | 4 +-
.../iotdb/commons/service/metric/enums/Metric.java | 7 +-
7 files changed, 148 insertions(+), 78 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/WritingMetrics.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/WritingMetrics.java
index efe2dacda2d..183d9a9f8c2 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/WritingMetrics.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/WritingMetrics.java
@@ -31,6 +31,7 @@ import
org.apache.iotdb.db.storageengine.dataregion.wal.checkpoint.CheckpointTyp
import org.apache.iotdb.metrics.AbstractMetricService;
import org.apache.iotdb.metrics.impl.DoNothingMetricManager;
import org.apache.iotdb.metrics.metricsets.IMetricSet;
+import org.apache.iotdb.metrics.type.Counter;
import org.apache.iotdb.metrics.type.Gauge;
import org.apache.iotdb.metrics.type.Histogram;
import org.apache.iotdb.metrics.type.Timer;
@@ -334,28 +335,53 @@ public class WritingMetrics implements IMetricSet {
"oldest_mem_table_ram_when_cause_flush";
public static final String FLUSH_TSFILE_SIZE = "flush_tsfile_size";
+ public static final String FLUSH_THRESHOLD = "flush_threshold";
+ public static final String REJECT_THRESHOLD = "reject_threshold";
+
+ public static final String TIMED_FLUSH_MEMTABLE_COUNT =
"timed_flush_memtable_count";
+ public static final String WAL_FLUSH_MEMTABLE_COUNT =
"wal_flush_memtable_count";
+ public static final String MANUAL_FLUSH_MEMTABLE_COUNT =
"manual_flush_memtable_count";
+ public static final String MEM_CONTROL_FLUSH_MEMTABLE_COUNT =
"mem_control_flush_memtable_count";
+ public static final String SERIES_FULL_FLUSH_MEMTABLE =
"series_full_flush_memtable";
+
private Gauge flushThreholdGauge = DoNothingMetricManager.DO_NOTHING_GAUGE;
private Gauge rejectThreholdGauge = DoNothingMetricManager.DO_NOTHING_GAUGE;
private Timer memtableLiveTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ private Counter walFlushMemtableCounter =
DoNothingMetricManager.DO_NOTHING_COUNTER;
+ private Counter timedFlushMemtableCounter =
DoNothingMetricManager.DO_NOTHING_COUNTER;
+ private Counter seriesFullFlushMemtableCounter =
DoNothingMetricManager.DO_NOTHING_COUNTER;
+ private Counter manualFlushMemtableCounter =
DoNothingMetricManager.DO_NOTHING_COUNTER;
+ private Counter memControlFlushMemtableCounter =
DoNothingMetricManager.DO_NOTHING_COUNTER;
+
public void bindDataRegionMetrics() {
List<DataRegion> allDataRegions =
StorageEngine.getInstance().getAllDataRegions();
List<DataRegionId> allDataRegionIds =
StorageEngine.getInstance().getAllDataRegionIds();
allDataRegions.forEach(this::createDataRegionMemoryCostMetrics);
allDataRegionIds.forEach(this::createFlushingMemTableStatusMetrics);
-
allDataRegionIds.forEach(this::createSeriesFullFlushMemTableCounterMetrics);
- allDataRegionIds.forEach(this::createTimedFlushMemTableCounterMetrics);
- allDataRegionIds.forEach(this::createWalFlushMemTableCounterMetrics);
allDataRegionIds.forEach(this::createActiveMemtableCounterMetrics);
createActiveTimePartitionCounterMetrics();
+ walFlushMemtableCounter = createWalFlushMemTableCounterMetrics();
+ timedFlushMemtableCounter = createTimedFlushMemTableCounterMetrics();
+ seriesFullFlushMemtableCounter =
createSeriesFullFlushMemTableCounterMetrics();
+ manualFlushMemtableCounter = createManualFlushMemTableCounterMetrics();
+ memControlFlushMemtableCounter =
createMemControlFlushMemTableCounterMetrics();
flushThreholdGauge =
MetricService.getInstance()
- .getOrCreateGauge(Metric.FLUSH_THRESHOLD.toString(),
MetricLevel.IMPORTANT);
+ .getOrCreateGauge(
+ Metric.MEMTABLE_THRESHOLD.toString(),
+ MetricLevel.IMPORTANT,
+ Tag.TYPE.toString(),
+ FLUSH_THRESHOLD);
rejectThreholdGauge =
MetricService.getInstance()
- .getOrCreateGauge(Metric.REJECT_THRESHOLD.toString(),
MetricLevel.IMPORTANT);
+ .getOrCreateGauge(
+ Metric.MEMTABLE_THRESHOLD.toString(),
+ MetricLevel.IMPORTANT,
+ Tag.TYPE.toString(),
+ REJECT_THRESHOLD);
memtableLiveTimer =
MetricService.getInstance()
@@ -368,14 +394,26 @@ public class WritingMetrics implements IMetricSet {
dataRegionId -> {
removeDataRegionMemoryCostMetrics(dataRegionId);
removeFlushingMemTableStatusMetrics(dataRegionId);
- removeSeriesFullFlushMemTableCounterMetrics(dataRegionId);
- removeTimedFlushMemTableCounterMetrics(dataRegionId);
- removeWalFlushMemTableCounterMetrics(dataRegionId);
removeActiveMemtableCounterMetrics(dataRegionId);
});
removeActiveTimePartitionCounterMetrics();
- MetricService.getInstance().remove(MetricType.GAUGE,
Metric.FLUSH_THRESHOLD.toString());
- MetricService.getInstance().remove(MetricType.GAUGE,
Metric.REJECT_THRESHOLD.toString());
+ removeSeriesFullFlushMemTableCounterMetrics();
+ removeTimedFlushMemTableCounterMetrics();
+ removeWalFlushMemTableCounterMetrics();
+ removeManualFlushMemTableCounterMetrics();
+ removeMemControlFlushMemTableCounterMetrics();
+ MetricService.getInstance()
+ .remove(
+ MetricType.GAUGE,
+ Metric.MEMTABLE_THRESHOLD.toString(),
+ Tag.TYPE.toString(),
+ FLUSH_THRESHOLD);
+ MetricService.getInstance()
+ .remove(
+ MetricType.GAUGE,
+ Metric.MEMTABLE_THRESHOLD.toString(),
+ Tag.TYPE.toString(),
+ REJECT_THRESHOLD);
MetricService.getInstance().remove(MetricType.TIMER,
Metric.MEMTABLE_LIVE_DURATION.toString());
}
@@ -454,31 +492,49 @@ public class WritingMetrics implements IMetricSet {
dataRegionId.toString()));
}
- public void createWalFlushMemTableCounterMetrics(DataRegionId dataRegionId) {
- MetricService.getInstance()
+ public Counter createWalFlushMemTableCounterMetrics() {
+ return MetricService.getInstance()
.getOrCreateCounter(
- Metric.WAL_FLUSH_MEMTABLE_COUNT.toString(),
+ Metric.FLUSH_MEMTABLE_COUNT.toString(),
MetricLevel.IMPORTANT,
- Tag.REGION.toString(),
- dataRegionId.toString());
+ Tag.TYPE.toString(),
+ WAL_FLUSH_MEMTABLE_COUNT);
}
- public void createTimedFlushMemTableCounterMetrics(DataRegionId
dataRegionId) {
- MetricService.getInstance()
+ public Counter createTimedFlushMemTableCounterMetrics() {
+ return MetricService.getInstance()
.getOrCreateCounter(
- Metric.TIMED_FLUSH_MEMTABLE_COUNT.toString(),
+ Metric.FLUSH_MEMTABLE_COUNT.toString(),
MetricLevel.IMPORTANT,
- Tag.REGION.toString(),
- dataRegionId.toString());
+ Tag.TYPE.toString(),
+ TIMED_FLUSH_MEMTABLE_COUNT);
}
- public void createSeriesFullFlushMemTableCounterMetrics(DataRegionId
dataRegionId) {
- MetricService.getInstance()
+ public Counter createSeriesFullFlushMemTableCounterMetrics() {
+ return MetricService.getInstance()
.getOrCreateCounter(
- Metric.SERIES_FULL_FLUSH_MEMTABLE.toString(),
+ Metric.FLUSH_MEMTABLE_COUNT.toString(),
MetricLevel.IMPORTANT,
- Tag.REGION.toString(),
- dataRegionId.toString());
+ Tag.TYPE.toString(),
+ SERIES_FULL_FLUSH_MEMTABLE);
+ }
+
+ public Counter createManualFlushMemTableCounterMetrics() {
+ return MetricService.getInstance()
+ .getOrCreateCounter(
+ Metric.FLUSH_MEMTABLE_COUNT.toString(),
+ MetricLevel.IMPORTANT,
+ Tag.TYPE.toString(),
+ MANUAL_FLUSH_MEMTABLE_COUNT);
+ }
+
+ public Counter createMemControlFlushMemTableCounterMetrics() {
+ return MetricService.getInstance()
+ .getOrCreateCounter(
+ Metric.FLUSH_MEMTABLE_COUNT.toString(),
+ MetricLevel.IMPORTANT,
+ Tag.TYPE.toString(),
+ MEM_CONTROL_FLUSH_MEMTABLE_COUNT);
}
public void createActiveMemtableCounterMetrics(DataRegionId dataRegionId) {
@@ -495,31 +551,49 @@ public class WritingMetrics implements IMetricSet {
.getOrCreateCounter(Metric.ACTIVE_TIME_PARTITION_COUNT.toString(),
MetricLevel.IMPORTANT);
}
- public void removeSeriesFullFlushMemTableCounterMetrics(DataRegionId
dataRegionId) {
+ public void removeSeriesFullFlushMemTableCounterMetrics() {
MetricService.getInstance()
.remove(
MetricType.COUNTER,
- Metric.SERIES_FULL_FLUSH_MEMTABLE.toString(),
- Tag.REGION.toString(),
- dataRegionId.toString());
+ Metric.FLUSH_MEMTABLE_COUNT.toString(),
+ Tag.TYPE.toString(),
+ SERIES_FULL_FLUSH_MEMTABLE);
}
- public void removeTimedFlushMemTableCounterMetrics(DataRegionId
dataRegionId) {
+ public void removeTimedFlushMemTableCounterMetrics() {
MetricService.getInstance()
.remove(
MetricType.COUNTER,
- Metric.TIMED_FLUSH_MEMTABLE_COUNT.toString(),
- Tag.REGION.toString(),
- dataRegionId.toString());
+ Metric.FLUSH_MEMTABLE_COUNT.toString(),
+ Tag.TYPE.toString(),
+ TIMED_FLUSH_MEMTABLE_COUNT);
}
- public void removeWalFlushMemTableCounterMetrics(DataRegionId dataRegionId) {
+ public void removeWalFlushMemTableCounterMetrics() {
MetricService.getInstance()
.remove(
MetricType.COUNTER,
- Metric.WAL_FLUSH_MEMTABLE_COUNT.toString(),
- Tag.REGION.toString(),
- dataRegionId.toString());
+ Metric.FLUSH_MEMTABLE_COUNT.toString(),
+ Tag.TYPE.toString(),
+ WAL_FLUSH_MEMTABLE_COUNT);
+ }
+
+ public void removeManualFlushMemTableCounterMetrics() {
+ MetricService.getInstance()
+ .remove(
+ MetricType.COUNTER,
+ Metric.FLUSH_MEMTABLE_COUNT.toString(),
+ Tag.TYPE.toString(),
+ MANUAL_FLUSH_MEMTABLE_COUNT);
+ }
+
+ public void removeMemControlFlushMemTableCounterMetrics() {
+ MetricService.getInstance()
+ .remove(
+ MetricType.COUNTER,
+ Metric.FLUSH_MEMTABLE_COUNT.toString(),
+ Tag.TYPE.toString(),
+ MEM_CONTROL_FLUSH_MEMTABLE_COUNT);
}
public void removeActiveMemtableCounterMetrics(DataRegionId dataRegionId) {
@@ -763,34 +837,24 @@ public class WritingMetrics implements IMetricSet {
memtableLiveTimer.updateMillis(durationMillis);
}
- public void recordTimedFlushMemTableCount(String dataRegionId, int number) {
- MetricService.getInstance()
- .count(
- number,
- Metric.TIMED_FLUSH_MEMTABLE_COUNT.toString(),
- MetricLevel.IMPORTANT,
- Tag.REGION.toString(),
- dataRegionId);
+ public void recordTimedFlushMemTableCount(int number) {
+ timedFlushMemtableCounter.inc(number);
}
- public void recordWalFlushMemTableCount(String dataRegionId, int number) {
- MetricService.getInstance()
- .count(
- number,
- Metric.WAL_FLUSH_MEMTABLE_COUNT.toString(),
- MetricLevel.IMPORTANT,
- Tag.REGION.toString(),
- dataRegionId);
+ public void recordWalFlushMemTableCount(int number) {
+ walFlushMemtableCounter.inc(number);
}
- public void recordSeriesFullFlushMemTableCount(String dataRegionId, int
number) {
- MetricService.getInstance()
- .count(
- number,
- Metric.SERIES_FULL_FLUSH_MEMTABLE.toString(),
- MetricLevel.IMPORTANT,
- Tag.REGION.toString(),
- dataRegionId);
+ public void recordSeriesFullFlushMemTableCount(int number) {
+ seriesFullFlushMemtableCounter.inc(number);
+ }
+
+ public void recordManualFlushMemTableCount(int number) {
+ manualFlushMemtableCounter.inc(number);
+ }
+
+ public void recordMemControlFlushMemTableCount(int number) {
+ memControlFlushMemtableCounter.inc(number);
}
public void recordActiveMemTableCount(String dataRegionId, int number) {
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/StorageEngine.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/StorageEngine.java
index e30069f70f0..0a768b90df8 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/StorageEngine.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/StorageEngine.java
@@ -413,9 +413,6 @@ public class StorageEngine implements IService {
logicalStorageGroupName);
WRITING_METRICS.createFlushingMemTableStatusMetrics(dataRegionId);
WRITING_METRICS.createDataRegionMemoryCostMetrics(dataRegion);
- WRITING_METRICS.createSeriesFullFlushMemTableCounterMetrics(dataRegionId);
- WRITING_METRICS.createWalFlushMemTableCounterMetrics(dataRegionId);
- WRITING_METRICS.createTimedFlushMemTableCounterMetrics(dataRegionId);
WRITING_METRICS.createActiveMemtableCounterMetrics(dataRegionId);
dataRegion.setCustomFlushListeners(customFlushListeners);
dataRegion.setCustomCloseFileListeners(customCloseFileListeners);
@@ -706,9 +703,6 @@ public class StorageEngine implements IService {
WRITING_METRICS.removeDataRegionMemoryCostMetrics(regionId);
WRITING_METRICS.removeFlushingMemTableStatusMetrics(regionId);
WRITING_METRICS.removeActiveMemtableCounterMetrics(regionId);
- WRITING_METRICS.removeWalFlushMemTableCounterMetrics(regionId);
- WRITING_METRICS.removeTimedFlushMemTableCounterMetrics(regionId);
- WRITING_METRICS.removeSeriesFullFlushMemTableCounterMetrics(regionId);
try {
region.abortCompaction();
region.syncDeleteDataFiles();
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
index 8c473652c93..e26096b34ef 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java
@@ -914,6 +914,7 @@ public class DataRegion implements IDataRegionForQuery {
// check memtable size and may asyncTryToFlush the work memtable
if (tsFileProcessor != null && tsFileProcessor.shouldFlush()) {
fileFlushPolicy.apply(this, tsFileProcessor,
tsFileProcessor.isSequence());
+ WritingMetrics.getInstance().recordMemControlFlushMemTableCount(1);
}
} finally {
writeUnlock();
@@ -1089,6 +1090,7 @@ public class DataRegion implements IDataRegionForQuery {
// check memtable size and may async try to flush the work memtable
if (tsFileProcessor.shouldFlush()) {
fileFlushPolicy.apply(this, tsFileProcessor, sequence);
+ WritingMetrics.getInstance().recordMemControlFlushMemTableCount(1);
}
return true;
}
@@ -1206,6 +1208,7 @@ public class DataRegion implements IDataRegionForQuery {
});
}
+ int count = 0;
List<InsertRowNode> executedInsertRowNodeList = new ArrayList<>();
for (Map.Entry<TsFileProcessor, InsertRowsNode> entry :
tsFileProcessorMap.entrySet()) {
TsFileProcessor tsFileProcessor = entry.getKey();
@@ -1224,8 +1227,10 @@ public class DataRegion implements IDataRegionForQuery {
// check memtable size and may asyncTryToFlush the work memtable
if (entry.getKey().shouldFlush()) {
fileFlushPolicy.apply(this, tsFileProcessor,
tsFileProcessor.isSequence());
+ count++;
}
}
+ WritingMetrics.getInstance().recordMemControlFlushMemTableCount(count);
PERFORMANCE_OVERVIEW_METRICS.recordCreateMemtableBlockCost(costsForMetrics[0]);
PERFORMANCE_OVERVIEW_METRICS.recordScheduleMemoryBlockCost(costsForMetrics[1]);
@@ -1323,6 +1328,7 @@ public class DataRegion implements IDataRegionForQuery {
// check memtable size and may asyncTryToFlush the work memtable
if (tsFileProcessor.shouldFlush()) {
fileFlushPolicy.apply(this, tsFileProcessor,
tsFileProcessor.isSequence());
+ WritingMetrics.getInstance().recordMemControlFlushMemTableCount(1);
}
} finally {
writeUnlock();
@@ -1490,6 +1496,7 @@ public class DataRegion implements IDataRegionForQuery {
e);
}
}
+ WritingMetrics.getInstance().recordManualFlushMemTableCount(1);
}
/**
@@ -1659,7 +1666,7 @@ public class DataRegion implements IDataRegionForQuery {
} finally {
writeUnlock();
}
- WritingMetrics.getInstance().recordTimedFlushMemTableCount(dataRegionId,
count);
+ WritingMetrics.getInstance().recordTimedFlushMemTableCount(count);
}
public void timedFlushUnseqMemTable() {
@@ -1685,7 +1692,7 @@ public class DataRegion implements IDataRegionForQuery {
} finally {
writeUnlock();
}
- WritingMetrics.getInstance().recordTimedFlushMemTableCount(dataRegionId,
count);
+ WritingMetrics.getInstance().recordTimedFlushMemTableCount(count);
}
/** This method will be blocked until all tsfile processors are closed. */
@@ -1731,21 +1738,25 @@ public class DataRegion implements IDataRegionForQuery {
List<Future<?>> asyncCloseAllWorkingTsFileProcessors() {
writeLock("asyncCloseAllWorkingTsFileProcessors");
List<Future<?>> futures = new ArrayList<>();
+ int count = 0;
try {
logger.info("async force close all files in database: {}", databaseName
+ "-" + dataRegionId);
// to avoid concurrent modification problem, we need a new array list
for (TsFileProcessor tsFileProcessor :
new ArrayList<>(workSequenceTsFileProcessors.values())) {
futures.add(asyncCloseOneTsFileProcessor(true, tsFileProcessor));
+ count++;
}
// to avoid concurrent modification problem, we need a new array list
for (TsFileProcessor tsFileProcessor :
new ArrayList<>(workUnsequenceTsFileProcessors.values())) {
futures.add(asyncCloseOneTsFileProcessor(false, tsFileProcessor));
+ count++;
}
} finally {
writeUnlock();
}
+ WritingMetrics.getInstance().recordManualFlushMemTableCount(count);
return futures;
}
@@ -3286,6 +3297,7 @@ public class DataRegion implements IDataRegionForQuery {
});
}
List<InsertRowNode> executedInsertRowNodeList = new ArrayList<>();
+ int count = 0;
for (Map.Entry<TsFileProcessor, InsertRowsNode> entry :
tsFileProcessorMap.entrySet()) {
TsFileProcessor tsFileProcessor = entry.getKey();
InsertRowsNode subInsertRowsNode = entry.getValue();
@@ -3303,8 +3315,10 @@ public class DataRegion implements IDataRegionForQuery {
// check memtable size and may asyncTryToFlush the work memtable
if (tsFileProcessor.shouldFlush()) {
fileFlushPolicy.apply(this, tsFileProcessor,
tsFileProcessor.isSequence());
+ count++;
}
}
+ WritingMetrics.getInstance().recordMemControlFlushMemTableCount(count);
PERFORMANCE_OVERVIEW_METRICS.recordCreateMemtableBlockCost(costsForMetrics[0]);
PERFORMANCE_OVERVIEW_METRICS.recordScheduleMemoryBlockCost(costsForMetrics[1]);
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
index b3a2e0139dc..2d8f84574ae 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/TsFileProcessor.java
@@ -1010,8 +1010,7 @@ public class TsFileProcessor {
"The avg series points num {} of tsfile {} reaches the threshold",
workMemTable.getTotalPointsNum() / workMemTable.getSeriesNumber(),
tsFileResource.getTsFile().getAbsolutePath());
- WritingMetrics.getInstance()
-
.recordSeriesFullFlushMemTableCount(dataRegionInfo.getDataRegion().getDataRegionId(),
1);
+ WritingMetrics.getInstance().recordSeriesFullFlushMemTableCount(1);
return true;
}
return false;
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java
index 9a4b99f9ec0..ac938a33f72 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java
@@ -486,7 +486,7 @@ public class WALNode implements IWALNode {
|| snapshotCount >= config.getMaxWalMemTableSnapshotNum()
|| oldestMemTableTVListsRamCost >
config.getWalMemTableSnapshotThreshold()) {
flushMemTable(dataRegion, oldestTsFile, oldestMemTable);
-
WRITING_METRICS.recordWalFlushMemTableCount(dataRegion.getDataRegionId(), 1);
+ WRITING_METRICS.recordWalFlushMemTableCount(1);
WRITING_METRICS.recordMemTableRamWhenCauseFlush(identifier,
oldestMemTableTVListsRamCost);
} else {
snapshotMemTable(dataRegion, oldestTsFile, oldestMemTableInfo);
diff --git
a/iotdb-core/metrics/core/src/main/java/org/apache/iotdb/metrics/core/type/IoTDBCounter.java
b/iotdb-core/metrics/core/src/main/java/org/apache/iotdb/metrics/core/type/IoTDBCounter.java
index 62960e088bf..eadd7289ea0 100644
---
a/iotdb-core/metrics/core/src/main/java/org/apache/iotdb/metrics/core/type/IoTDBCounter.java
+++
b/iotdb-core/metrics/core/src/main/java/org/apache/iotdb/metrics/core/type/IoTDBCounter.java
@@ -38,7 +38,9 @@ public class IoTDBCounter extends AbstractMetricMBean
implements Counter, IoTDBC
@Override
public void inc(long n) {
- this.count.add(n);
+ if (n != 0) {
+ this.count.add(n);
+ }
}
@Override
diff --git
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java
index 7966617104e..7a2068a0a90 100644
---
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java
+++
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/service/metric/enums/Metric.java
@@ -76,11 +76,8 @@ public enum Metric {
WAL_COST("wal_cost"),
FLUSH_COST("flush_cost"),
FLUSH_SUB_TASK_COST("flush_sub_task_cost"),
- FLUSH_THRESHOLD("flush_threshold"),
- REJECT_THRESHOLD("reject_threshold"),
- TIMED_FLUSH_MEMTABLE_COUNT("timed_flush_memtable_count"),
- WAL_FLUSH_MEMTABLE_COUNT("wal_flush_memtable_count"),
- SERIES_FULL_FLUSH_MEMTABLE("series_full_flush_memtable"),
+ MEMTABLE_THRESHOLD("memtable_threshold"),
+ FLUSH_MEMTABLE_COUNT("flush_memtable_count"),
ACTIVE_MEMTABLE_COUNT("active_memtable_count"),
ACTIVE_TIME_PARTITION_COUNT("active_time_partition_count"),
MEMTABLE_LIVE_DURATION("memtable_live_duration"),