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 2024/07/03 12:49:29 UTC
(iotdb) branch master updated: PipeConsensus: Fix Metric Error regarding to SyncLag、FailedEventCount、ErrorTime etc. (#12849)
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 3f4b3afad3b PipeConsensus: Fix Metric Error regarding to SyncLag、FailedEventCount、ErrorTime etc. (#12849)
3f4b3afad3b is described below
commit 3f4b3afad3b8f0ffdd14963c2b77dd8cb4ac7c22
Author: Peng Junzhi <78...@users.noreply.github.com>
AuthorDate: Wed Jul 3 07:49:23 2024 -0500
PipeConsensus: Fix Metric Error regarding to SyncLag、FailedEventCount、ErrorTime etc. (#12849)
* fix metric
* fix metric
---
.../pipeconsensus/PipeConsensusAsyncConnector.java | 10 +++++-----
.../pipe/consensus/PipeConsensusConnectorMetrics.java | 19 ++++++++++---------
.../protocol/pipeconsensus/PipeConsensusReceiver.java | 5 ++++-
3 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/pipeconsensus/PipeConsensusAsyncConnector.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/pipeconsensus/PipeConsensusAsyncConnector.java
index 2262a3c8b84..6088ed8498b 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/pipeconsensus/PipeConsensusAsyncConnector.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/pipeconsensus/PipeConsensusAsyncConnector.java
@@ -122,17 +122,17 @@ public class PipeConsensusAsyncConnector extends IoTDBConnector implements Conse
throws Exception {
super.customize(parameters, configuration);
+ // Get consensusGroupId from parameters passed by PipeConsensusImpl
+ consensusGroupId = parameters.getInt(CONNECTOR_CONSENSUS_GROUP_ID_KEY);
+ // Get consensusPipeName from parameters passed by PipeConsensusImpl
+ consensusPipeName = parameters.getString(CONNECTOR_CONSENSUS_PIPE_NAME);
+
// initialize metric components
pipeConsensusConnectorMetrics = new PipeConsensusConnectorMetrics(this);
PipeConsensusSyncLagManager.getInstance(getConsensusGroupIdStr())
.addConsensusPipeConnector(this);
MetricService.getInstance().addMetricSet(this.pipeConsensusConnectorMetrics);
- // Get consensusGroupId from parameters passed by PipeConsensusImpl
- consensusGroupId = parameters.getInt(CONNECTOR_CONSENSUS_GROUP_ID_KEY);
- // Get consensusPipeName from parameters passed by PipeConsensusImpl
- consensusPipeName = parameters.getString(CONNECTOR_CONSENSUS_PIPE_NAME);
-
// In PipeConsensus, one pipeConsensusTask corresponds to a pipeConsensusConnector. Thus,
// `nodeUrls` here actually is a singletonList that contains one peer's TEndPoint. But here we
// retain the implementation of list to cope with possible future expansion
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/PipeConsensusConnectorMetrics.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/PipeConsensusConnectorMetrics.java
index 7950fd76744..23ab4d410c4 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/PipeConsensusConnectorMetrics.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/PipeConsensusConnectorMetrics.java
@@ -90,15 +90,16 @@ public class PipeConsensusConnectorMetrics implements IMetricSet {
}
private void bindCounter(AbstractMetricService metricService) {
- metricService.getOrCreateCounter(
- Metric.PIPE_RETRY_SEND_EVENT.toString(),
- MetricLevel.IMPORTANT,
- Tag.NAME.toString(),
- CONNECTOR,
- Tag.REGION.toString(),
- pipeConsensusAsyncConnector.getConsensusGroupIdStr(),
- Tag.TYPE.toString(),
- "pipeConsensusRetryCount");
+ retryCounter =
+ metricService.getOrCreateCounter(
+ Metric.PIPE_RETRY_SEND_EVENT.toString(),
+ MetricLevel.IMPORTANT,
+ Tag.NAME.toString(),
+ CONNECTOR,
+ Tag.REGION.toString(),
+ pipeConsensusAsyncConnector.getConsensusGroupIdStr(),
+ Tag.TYPE.toString(),
+ "pipeConsensusRetryCount");
}
private void bindAutoGauge(AbstractMetricService metricService) {
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java
index a056d123443..0f5af27e0a7 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/receiver/protocol/pipeconsensus/PipeConsensusReceiver.java
@@ -1419,12 +1419,15 @@ public class PipeConsensusReceiver {
public void setStartApplyNanos(long startApplyNanos) {
// Notice that a tsFileInsertionEvent will enter RequestExecutor multiple times, we only need
// to record the time of the first apply
- if (startApplyNanos == 0) {
+ if (this.startApplyNanos == 0) {
this.startApplyNanos = startApplyNanos;
}
}
public long getStartApplyNanos() {
+ if (startApplyNanos == 0) {
+ return System.nanoTime();
+ }
return startApplyNanos;
}