diff --git a/hadoop-common-project/hadoop-common/src/site/markdown/Metrics.md b/hadoop-common-project/hadoop-common/src/site/markdown/Metrics.md index cb2b48d60f839..b75523b08a0e2 100644 --- a/hadoop-common-project/hadoop-common/src/site/markdown/Metrics.md +++ b/hadoop-common-project/hadoop-common/src/site/markdown/Metrics.md @@ -458,6 +458,8 @@ Each metrics record contains tags such as SessionId and Hostname as additional i | `BlockReportsAvgTime` | Average time of block report operations in milliseconds | | `BlockReports`*ServiceId*`-`*NNId*`NumOps` | Total number of block report operations to specific serviceId and nnId | | `BlockReports`*ServiceId*`-`*NNId*`AvgTime` | Average time of block report operations to specific serviceId and nnId in milliseconds | +| `BlockReportsCreateCostMillsNumOps` | Total number of block report creating operations | +| `BlockReportsCreateCostMillsAvgTime` | Average time of block report creating operations in milliseconds | | `IncrementalBlockReportsNumOps` | Total number of incremental block report operations | | `IncrementalBlockReportsAvgTime` | Average time of incremental block report operations in milliseconds | | `IncrementalBlockReports`*ServiceId*`-`*NNId*`NumOps` | Total number of incremental block report operations to specific serviceId and nnId | diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java index 13ff9549e0200..462b9df3c9c81 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java @@ -452,6 +452,7 @@ List blockReport(long fullBrLeaseId) throws IOException { // Log the block report processing stats from Datanode perspective long brSendCost = monotonicNow() - brSendStartTime; long brCreateCost = brSendStartTime - brCreateStartTime; + dn.getMetrics().addBlockReportCreateCost(brCreateCost); dn.getMetrics().addBlockReport(brSendCost, getRpcMetricSuffix()); final int nCmds = cmds.size(); LOG.info((success ? "S" : "Uns") + diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/metrics/DataNodeMetrics.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/metrics/DataNodeMetrics.java index 77e6dab067b9d..d5fcfc9544229 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/metrics/DataNodeMetrics.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/metrics/DataNodeMetrics.java @@ -132,6 +132,7 @@ public class DataNodeMetrics { @Metric MutableRate heartbeatsTotal; @Metric MutableRate lifelines; @Metric MutableRate blockReports; + @Metric private MutableRate blockReportsCreateCostMills; @Metric MutableRate incrementalBlockReports; @Metric MutableRate cacheReports; @Metric MutableRate packetAckRoundTripTimeNanos; @@ -321,6 +322,10 @@ public void addBlockReport(long latency, String rpcMetricSuffix) { } } + public void addBlockReportCreateCost(long latency) { + blockReportsCreateCostMills.add(latency); + } + public void addIncrementalBlockReport(long latency, String rpcMetricSuffix) { incrementalBlockReports.add(latency);