This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch iotdb-3791
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/iotdb-3791 by this push:
new da1db17268 add metrics for processor
da1db17268 is described below
commit da1db17268e4017ecd96548cdf6466fa473f98aa
Author: Jinrui.Zhang <[email protected]>
AuthorDate: Thu Jul 14 17:32:10 2022 +0800
add metrics for processor
---
.../multileader/service/MultiLeaderRPCServiceProcessor.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/service/MultiLeaderRPCServiceProcessor.java
b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/service/MultiLeaderRPCServiceProcessor.java
index b83c900892..87555bbea0 100644
---
a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/service/MultiLeaderRPCServiceProcessor.java
+++
b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/service/MultiLeaderRPCServiceProcessor.java
@@ -20,6 +20,7 @@
package org.apache.iotdb.consensus.multileader.service;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
+import org.apache.iotdb.commons.StepTracker;
import org.apache.iotdb.commons.consensus.ConsensusGroupId;
import org.apache.iotdb.consensus.common.request.ByteBufferConsensusRequest;
import org.apache.iotdb.consensus.common.request.MultiLeaderConsensusRequest;
@@ -51,6 +52,7 @@ public class MultiLeaderRPCServiceProcessor implements
MultiLeaderConsensusIServ
@Override
public void syncLog(TSyncLogReq req, AsyncMethodCallback<TSyncLogRes>
resultHandler) {
+ long startTime = System.nanoTime();
try {
ConsensusGroupId groupId =
ConsensusGroupId.Factory.createFromTConsensusGroupId(req.getConsensusGroupId());
@@ -70,6 +72,7 @@ public class MultiLeaderRPCServiceProcessor implements
MultiLeaderConsensusIServ
// We use synchronized to ensure atomicity of executing multiple logs
synchronized (impl.getStateMachine()) {
for (TLogBatch batch : req.getBatches()) {
+ long writeOneBatch = System.nanoTime();
statuses.add(
impl.getStateMachine()
.write(
@@ -77,12 +80,15 @@ public class MultiLeaderRPCServiceProcessor implements
MultiLeaderConsensusIServ
batch.isFromWAL()
? new MultiLeaderConsensusRequest(batch.data)
: new ByteBufferConsensusRequest(batch.data))));
+ StepTracker.trace("writeOneBatch", 400, writeOneBatch,
System.nanoTime());
}
}
logger.debug("Execute TSyncLogReq for {} with result {}",
req.consensusGroupId, statuses);
resultHandler.onComplete(new TSyncLogRes(statuses));
} catch (Exception e) {
resultHandler.onError(e);
+ } finally {
+ StepTracker.trace("SyncLogProcess", 10, startTime, System.nanoTime());
}
}