Skip to content

Commit

Permalink
HDFS-17345. Add a metrics to record block report generating cost time. (
Browse files Browse the repository at this point in the history
#6475). Contributed by farmmamba.

Reviewed-by:  Shuyan Zhang <[email protected]>
Signed-off-by:  Shuyan Zhang <[email protected]>
  • Loading branch information
hfutatzhanghb authored Mar 6, 2024
1 parent 5584efd commit 7012986
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ List<DatanodeCommand> 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") +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7012986

Please sign in to comment.