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/09/14 13:02:29 UTC
[iotdb] branch master updated: [IOTDB-6152] Add IoTConsensus Sync Log Timer (#11134)
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 77a7dcf6ad0 [IOTDB-6152] Add IoTConsensus Sync Log Timer (#11134)
77a7dcf6ad0 is described below
commit 77a7dcf6ad0917baf24e4ba845ce1f87b13a3ee7
Author: Xiangpeng Hu <65...@users.noreply.github.com>
AuthorDate: Thu Sep 14 21:02:23 2023 +0800
[IOTDB-6152] Add IoTConsensus Sync Log Timer (#11134)
---
.../consensus/iot/IoTConsensusServerImpl.java | 32 ++++-
.../consensus/iot/IoTConsensusServerMetrics.java | 154 +++++++++++++++------
.../consensus/iot/client/DispatchLogHandler.java | 3 +-
.../consensus/iot/logdispatcher/LogDispatcher.java | 3 +-
.../logdispatcher/LogDispatcherThreadMetrics.java | 50 +++----
.../service/IoTConsensusRPCServiceProcessor.java | 3 +
.../iotdb/commons/service/metric/enums/Metric.java | 2 +
7 files changed, 171 insertions(+), 76 deletions(-)
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
index 92f3584705f..47aa7756344 100644
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
+++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
@@ -740,6 +740,10 @@ public class IoTConsensusServerImpl {
return retryService;
}
+ public IoTConsensusServerMetrics getIoTConsensusServerMetrics() {
+ return this.ioTConsensusServerMetrics;
+ }
+
public boolean isReadOnly() {
return stateMachine.isReadOnly();
}
@@ -839,8 +843,16 @@ public class IoTConsensusServerImpl {
* deserialization of PlanNode to be concurrent
*/
private TSStatus cacheAndInsertLatestNode(DeserializedBatchIndexedConsensusRequest request) {
+ logger.debug(
+ "cacheAndInsert start: source = {}, region = {}, queue size {}, startSyncIndex = {}, endSyncIndex = {}",
+ sourcePeerId,
+ consensusGroupId,
+ requestCache.size(),
+ request.getStartSyncIndex(),
+ request.getEndSyncIndex());
queueLock.lock();
try {
+ long insertStartTime = System.nanoTime();
requestCache.add(request);
// If the peek is not hold by current thread, it should notify the corresponding thread to
// process the peek when the queue is full
@@ -898,18 +910,24 @@ public class IoTConsensusServerImpl {
Thread.currentThread().interrupt();
}
}
- logger.debug(
- "source = {}, region = {}, queue size {}, startSyncIndex = {}, endSyncIndex = {}",
- sourcePeerId,
- consensusGroupId,
- requestCache.size(),
- request.getStartSyncIndex(),
- request.getEndSyncIndex());
+ long sortTime = System.nanoTime();
+ ioTConsensusServerMetrics.recordSortCost(sortTime - insertStartTime);
List<TSStatus> subStatus = new LinkedList<>();
for (IConsensusRequest insertNode : request.getInsertNodes()) {
subStatus.add(stateMachine.write(insertNode));
}
+ long applyTime = System.nanoTime();
+ ioTConsensusServerMetrics.recordApplyCost(applyTime - sortTime);
queueSortCondition.signalAll();
+ logger.debug(
+ "cacheAndInsert end: source = {}, region = {}, queue size {}, startSyncIndex = {}, endSyncIndex = {}, sortTime = {}ms, applyTime = {}ms",
+ sourcePeerId,
+ consensusGroupId,
+ requestCache.size(),
+ request.getStartSyncIndex(),
+ request.getEndSyncIndex(),
+ TimeUnit.NANOSECONDS.toMillis(sortTime - insertStartTime),
+ TimeUnit.NANOSECONDS.toMillis(applyTime - sortTime));
return new TSStatus().setSubStatus(subStatus);
} finally {
queueLock.unlock();
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerMetrics.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerMetrics.java
index 98e8787977d..736236f47d5 100644
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerMetrics.java
+++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerMetrics.java
@@ -24,18 +24,25 @@ import org.apache.iotdb.commons.service.metric.enums.Tag;
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.Histogram;
+import org.apache.iotdb.metrics.type.Timer;
import org.apache.iotdb.metrics.utils.MetricLevel;
import org.apache.iotdb.metrics.utils.MetricType;
public class IoTConsensusServerMetrics implements IMetricSet {
private final IoTConsensusServerImpl impl;
- private Histogram getStateMachineLockHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
- private Histogram checkingBeforeWriteHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
- private Histogram writeStateMachineHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
- private Histogram offerRequestToQueueHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
- private Histogram consensusWriteHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
+ private Timer getStateMachineLockTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ private Timer checkingBeforeWriteTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ private Timer writeStateMachineTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ private Timer offerRequestToQueueTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ private Timer consensusWriteTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ private static final String IOT_RECEIVE_LOG = Metric.IOT_RECEIVE_LOG.toString();
+ private Timer deserializeTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ private Timer sortTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ private Timer applyTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ private static final String DESERIALIZE = "deserialize";
+ private static final String SORT = "sort";
+ private static final String APPLY = "apply";
public IoTConsensusServerMetrics(IoTConsensusServerImpl impl) {
this.impl = impl;
@@ -43,16 +50,30 @@ public class IoTConsensusServerMetrics implements IMetricSet {
private static final String IMPL = "ioTConsensusServerImpl";
+ public void recordDeserializeCost(long costTimeInNanos) {
+ deserializeTimer.updateNanos(costTimeInNanos);
+ }
+
+ public void recordSortCost(long costTimeInNanos) {
+ sortTimer.updateNanos(costTimeInNanos);
+ }
+
+ public void recordApplyCost(long costTimeInNanos) {
+ applyTimer.updateNanos(costTimeInNanos);
+ }
+
@Override
public void bindTo(AbstractMetricService metricService) {
bindAutoGauge(metricService);
- bindStageHistogram(metricService);
+ bindStageTimer(metricService);
+ bindSyncLogTimer(metricService);
}
@Override
public void unbindFrom(AbstractMetricService metricService) {
unbindAutoGauge(metricService);
- unbindStageHistogram(metricService);
+ unbindStageTimer(metricService);
+ unbindSyncLogTimer(metricService);
}
private void bindAutoGauge(AbstractMetricService metricService) {
@@ -114,9 +135,9 @@ public class IoTConsensusServerMetrics implements IMetricSet {
"LogEntriesFromQueue");
}
- private void bindStageHistogram(AbstractMetricService metricService) {
- getStateMachineLockHistogram =
- metricService.getOrCreateHistogram(
+ private void bindStageTimer(AbstractMetricService metricService) {
+ getStateMachineLockTimer =
+ metricService.getOrCreateTimer(
Metric.STAGE.toString(),
MetricLevel.IMPORTANT,
Tag.NAME.toString(),
@@ -125,8 +146,8 @@ public class IoTConsensusServerMetrics implements IMetricSet {
"getStateMachineLock",
Tag.REGION.toString(),
impl.getConsensusGroupId());
- checkingBeforeWriteHistogram =
- metricService.getOrCreateHistogram(
+ checkingBeforeWriteTimer =
+ metricService.getOrCreateTimer(
Metric.STAGE.toString(),
MetricLevel.IMPORTANT,
Tag.NAME.toString(),
@@ -135,8 +156,8 @@ public class IoTConsensusServerMetrics implements IMetricSet {
"checkingBeforeWrite",
Tag.REGION.toString(),
impl.getConsensusGroupId());
- writeStateMachineHistogram =
- metricService.getOrCreateHistogram(
+ writeStateMachineTimer =
+ metricService.getOrCreateTimer(
Metric.STAGE.toString(),
MetricLevel.IMPORTANT,
Tag.NAME.toString(),
@@ -145,8 +166,8 @@ public class IoTConsensusServerMetrics implements IMetricSet {
"writeStateMachine",
Tag.REGION.toString(),
impl.getConsensusGroupId());
- offerRequestToQueueHistogram =
- metricService.getOrCreateHistogram(
+ offerRequestToQueueTimer =
+ metricService.getOrCreateTimer(
Metric.STAGE.toString(),
MetricLevel.IMPORTANT,
Tag.NAME.toString(),
@@ -155,8 +176,8 @@ public class IoTConsensusServerMetrics implements IMetricSet {
"offerRequestToQueue",
Tag.REGION.toString(),
impl.getConsensusGroupId());
- consensusWriteHistogram =
- metricService.getOrCreateHistogram(
+ consensusWriteTimer =
+ metricService.getOrCreateTimer(
Metric.STAGE.toString(),
MetricLevel.IMPORTANT,
Tag.NAME.toString(),
@@ -167,6 +188,34 @@ public class IoTConsensusServerMetrics implements IMetricSet {
impl.getConsensusGroupId());
}
+ private void bindSyncLogTimer(AbstractMetricService metricService) {
+ // bind sync log timers
+ deserializeTimer =
+ metricService.getOrCreateTimer(
+ IOT_RECEIVE_LOG,
+ MetricLevel.IMPORTANT,
+ Tag.STAGE.toString(),
+ DESERIALIZE,
+ Tag.REGION.toString(),
+ impl.getConsensusGroupId());
+ sortTimer =
+ metricService.getOrCreateTimer(
+ IOT_RECEIVE_LOG,
+ MetricLevel.IMPORTANT,
+ Tag.STAGE.toString(),
+ SORT,
+ Tag.REGION.toString(),
+ impl.getConsensusGroupId());
+ applyTimer =
+ metricService.getOrCreateTimer(
+ IOT_RECEIVE_LOG,
+ MetricLevel.IMPORTANT,
+ Tag.STAGE.toString(),
+ APPLY,
+ Tag.REGION.toString(),
+ impl.getConsensusGroupId());
+ }
+
private void unbindAutoGauge(AbstractMetricService metricService) {
metricService.remove(
MetricType.AUTO_GAUGE,
@@ -215,14 +264,14 @@ public class IoTConsensusServerMetrics implements IMetricSet {
"LogEntriesFromQueue");
}
- private void unbindStageHistogram(AbstractMetricService metricService) {
- getStateMachineLockHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
- checkingBeforeWriteHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
- writeStateMachineHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
- offerRequestToQueueHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
- consensusWriteHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
+ private void unbindStageTimer(AbstractMetricService metricService) {
+ getStateMachineLockTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ checkingBeforeWriteTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ writeStateMachineTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ offerRequestToQueueTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ consensusWriteTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
metricService.remove(
- MetricType.HISTOGRAM,
+ MetricType.TIMER,
Metric.STAGE.toString(),
Tag.NAME.toString(),
Metric.IOT_CONSENSUS.toString(),
@@ -231,7 +280,7 @@ public class IoTConsensusServerMetrics implements IMetricSet {
Tag.REGION.toString(),
impl.getConsensusGroupId());
metricService.remove(
- MetricType.HISTOGRAM,
+ MetricType.TIMER,
Metric.STAGE.toString(),
Tag.NAME.toString(),
Metric.IOT_CONSENSUS.toString(),
@@ -240,7 +289,7 @@ public class IoTConsensusServerMetrics implements IMetricSet {
Tag.REGION.toString(),
impl.getConsensusGroupId());
metricService.remove(
- MetricType.HISTOGRAM,
+ MetricType.TIMER,
Metric.STAGE.toString(),
Tag.NAME.toString(),
Metric.IOT_CONSENSUS.toString(),
@@ -249,7 +298,7 @@ public class IoTConsensusServerMetrics implements IMetricSet {
Tag.REGION.toString(),
impl.getConsensusGroupId());
metricService.remove(
- MetricType.HISTOGRAM,
+ MetricType.TIMER,
Metric.STAGE.toString(),
Tag.NAME.toString(),
Metric.IOT_CONSENSUS.toString(),
@@ -258,7 +307,7 @@ public class IoTConsensusServerMetrics implements IMetricSet {
Tag.REGION.toString(),
impl.getConsensusGroupId());
metricService.remove(
- MetricType.HISTOGRAM,
+ MetricType.TIMER,
Metric.STAGE.toString(),
Tag.NAME.toString(),
Metric.IOT_CONSENSUS.toString(),
@@ -268,23 +317,48 @@ public class IoTConsensusServerMetrics implements IMetricSet {
impl.getConsensusGroupId());
}
- public void recordGetStateMachineLockTime(long time) {
- getStateMachineLockHistogram.update(time);
+ private void unbindSyncLogTimer(AbstractMetricService metricService) {
+ // unbind sync log timers
+ metricService.remove(
+ MetricType.TIMER,
+ IOT_RECEIVE_LOG,
+ Tag.STAGE.toString(),
+ DESERIALIZE,
+ Tag.REGION.toString(),
+ impl.getConsensusGroupId());
+ metricService.remove(
+ MetricType.TIMER,
+ IOT_RECEIVE_LOG,
+ Tag.STAGE.toString(),
+ SORT,
+ Tag.REGION.toString(),
+ impl.getConsensusGroupId());
+ metricService.remove(
+ MetricType.TIMER,
+ IOT_RECEIVE_LOG,
+ Tag.STAGE.toString(),
+ APPLY,
+ Tag.REGION.toString(),
+ impl.getConsensusGroupId());
+ }
+
+ public void recordGetStateMachineLockTime(long costTimeInNanos) {
+ getStateMachineLockTimer.updateNanos(costTimeInNanos);
}
- public void recordCheckingBeforeWriteTime(long time) {
- checkingBeforeWriteHistogram.update(time);
+ public void recordCheckingBeforeWriteTime(long costTimeInNanos) {
+ checkingBeforeWriteTimer.updateNanos(costTimeInNanos);
}
- public void recordWriteStateMachineTime(long time) {
- writeStateMachineHistogram.update(time);
+ public void recordWriteStateMachineTime(long costTimeInNanos) {
+ writeStateMachineTimer.updateNanos(costTimeInNanos);
}
- public void recordOfferRequestToQueueTime(long time) {
- offerRequestToQueueHistogram.update(time);
+ public void recordOfferRequestToQueueTime(long costTimeInNanos) {
+ offerRequestToQueueTimer.updateNanos(costTimeInNanos);
}
- public void recordConsensusWriteTime(long time) {
- consensusWriteHistogram.update(time);
+ public void recordConsensusWriteTime(long costTimeInNanos) {
+ consensusWriteTimer.updateNanos(costTimeInNanos);
}
}
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/client/DispatchLogHandler.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/client/DispatchLogHandler.java
index f69ea0c2d76..b851b29981b 100644
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/client/DispatchLogHandler.java
+++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/client/DispatchLogHandler.java
@@ -66,8 +66,7 @@ public class DispatchLogHandler implements AsyncMethodCallback<TSyncLogEntriesRe
// update safely deleted search index after current sync index is updated by removeBatch
thread.updateSafelyDeletedSearchIndex();
}
- logDispatcherThreadMetrics.recordSyncLogTimePerRequest(
- (System.nanoTime() - createTime) / batch.getLogEntries().size());
+ logDispatcherThreadMetrics.recordSyncLogTimePerRequest(System.nanoTime() - createTime);
}
private boolean needRetry(int statusCode) {
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcher.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcher.java
index 30a2cc2d22c..93c931b84b6 100644
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcher.java
+++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcher.java
@@ -323,8 +323,7 @@ public class LogDispatcher {
}
}
}
- logDispatcherThreadMetrics.recordConstructBatchTime(
- (System.nanoTime() - startTime) / batch.getLogEntries().size());
+ logDispatcherThreadMetrics.recordConstructBatchTime(System.nanoTime() - startTime);
// we may block here if the synchronization pipeline is full
syncStatus.addNextBatch(batch);
logEntriesFromWAL.addAndGet(batch.getLogEntriesNumFromWAL());
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcherThreadMetrics.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcherThreadMetrics.java
index bcfc8382eeb..f30f8c23094 100644
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcherThreadMetrics.java
+++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/logdispatcher/LogDispatcherThreadMetrics.java
@@ -24,7 +24,7 @@ import org.apache.iotdb.commons.service.metric.enums.Tag;
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.Histogram;
+import org.apache.iotdb.metrics.type.Timer;
import org.apache.iotdb.metrics.utils.MetricLevel;
import org.apache.iotdb.metrics.utils.MetricType;
@@ -32,26 +32,26 @@ public class LogDispatcherThreadMetrics implements IMetricSet {
private final LogDispatcher.LogDispatcherThread logDispatcherThread;
private final String peerGroupId;
- private Histogram constructBatchHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
- private Histogram syncLogTimePerRequestHistogram = DoNothingMetricManager.DO_NOTHING_HISTOGRAM;
+ private Timer constructBatchTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
+ private Timer syncLogTimePerRequestTimer = DoNothingMetricManager.DO_NOTHING_TIMER;
public LogDispatcherThreadMetrics(LogDispatcher.LogDispatcherThread logDispatcherThread) {
this.logDispatcherThread = logDispatcherThread;
this.peerGroupId = logDispatcherThread.getPeer().getGroupId().toString();
}
- public void recordConstructBatchTime(long time) {
- constructBatchHistogram.update(time);
+ public void recordConstructBatchTime(long costTimeInNanos) {
+ constructBatchTimer.updateNanos(costTimeInNanos);
}
- public void recordSyncLogTimePerRequest(long time) {
- syncLogTimePerRequestHistogram.update(time);
+ public void recordSyncLogTimePerRequest(long costTimeInNanos) {
+ syncLogTimePerRequestTimer.updateNanos(costTimeInNanos);
}
@Override
public void bindTo(AbstractMetricService metricService) {
bindAutoGauge(metricService);
- bindStageHistogram(metricService);
+ bindStageTimer(metricService);
}
private void bindAutoGauge(AbstractMetricService metricService) {
@@ -90,45 +90,45 @@ public class LogDispatcherThreadMetrics implements IMetricSet {
"cachedRequestInMemoryQueue");
}
- private void bindStageHistogram(AbstractMetricService metricService) {
- constructBatchHistogram =
- metricService.getOrCreateHistogram(
- Metric.STAGE.toString(),
+ private void bindStageTimer(AbstractMetricService metricService) {
+ constructBatchTimer =
+ metricService.getOrCreateTimer(
+ Metric.IOT_SEND_LOG.toString(),
MetricLevel.IMPORTANT,
Tag.NAME.toString(),
Metric.IOT_CONSENSUS.toString(),
- Tag.TYPE.toString(),
+ Tag.STAGE.toString(),
"constructBatch",
Tag.REGION.toString(),
peerGroupId);
- syncLogTimePerRequestHistogram =
- metricService.getOrCreateHistogram(
- Metric.STAGE.toString(),
+ syncLogTimePerRequestTimer =
+ metricService.getOrCreateTimer(
+ Metric.IOT_SEND_LOG.toString(),
MetricLevel.IMPORTANT,
Tag.NAME.toString(),
Metric.IOT_CONSENSUS.toString(),
- Tag.TYPE.toString(),
+ Tag.STAGE.toString(),
"syncLogTimePerRequest",
Tag.REGION.toString(),
peerGroupId);
}
- private void unbindStageHistogram(AbstractMetricService metricService) {
+ private void unbindStageTimer(AbstractMetricService metricService) {
metricService.remove(
- MetricType.HISTOGRAM,
- Metric.STAGE.toString(),
+ MetricType.TIMER,
+ Metric.IOT_SEND_LOG.toString(),
Tag.NAME.toString(),
Metric.IOT_CONSENSUS.toString(),
- Tag.TYPE.toString(),
+ Tag.STAGE.toString(),
"constructBatch",
Tag.REGION.toString(),
peerGroupId);
metricService.remove(
- MetricType.HISTOGRAM,
- Metric.STAGE.toString(),
+ MetricType.TIMER,
+ Metric.IOT_SEND_LOG.toString(),
Tag.NAME.toString(),
Metric.IOT_CONSENSUS.toString(),
- Tag.TYPE.toString(),
+ Tag.STAGE.toString(),
"syncLogTimePerRequest",
Tag.REGION.toString(),
peerGroupId);
@@ -137,7 +137,7 @@ public class LogDispatcherThreadMetrics implements IMetricSet {
@Override
public void unbindFrom(AbstractMetricService metricService) {
unbindAutoGauge(metricService);
- unbindStageHistogram(metricService);
+ unbindStageTimer(metricService);
}
private void unbindAutoGauge(AbstractMetricService metricService) {
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/service/IoTConsensusRPCServiceProcessor.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/service/IoTConsensusRPCServiceProcessor.java
index 0921d0a9623..a793d40139b 100644
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/service/IoTConsensusRPCServiceProcessor.java
+++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/service/IoTConsensusRPCServiceProcessor.java
@@ -115,8 +115,11 @@ public class IoTConsensusRPCServiceProcessor implements IoTConsensusIService.Asy
: ByteBufferConsensusRequest::new)
.collect(Collectors.toList())));
}
+ long buildRequestTime = System.nanoTime();
IConsensusRequest deserializedRequest =
impl.getStateMachine().deserializeRequest(logEntriesInThisBatch);
+ impl.getIoTConsensusServerMetrics()
+ .recordDeserializeCost(System.nanoTime() - buildRequestTime);
TSStatus writeStatus =
impl.syncLog(logEntriesInThisBatch.getSourcePeerId(), deserializedRequest);
logger.debug(
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 c377ffbbbcd..b6e5fbee5e8 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
@@ -45,6 +45,8 @@ public enum Metric {
// consensus related
STAGE("stage"),
IOT_CONSENSUS("iot_consensus"),
+ IOT_SEND_LOG("iot_send_log"),
+ IOT_RECEIVE_LOG("iot_receive_log"),
RATIS_CONSENSUS_WRITE("ratis_consensus_write"),
RATIS_CONSENSUS_READ("ratis_consensus_read"),
// storage engine related