ashishkumar50 commented on code in PR #7522:
URL: https://github.com/apache/ozone/pull/7522#discussion_r1883297788
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/ScmBlockDeletingServiceMetrics.java:
##########
@@ -196,6 +226,116 @@ public long getNumBlockDeletionTransactionDataNodes() {
return numBlockDeletionTransactionDataNodes.value();
}
+ public Map<UUID, DatanodeCommandCounts> getNumCommandsDatanode() {
+ return numCommandsDatanode;
+ }
+
+ @Override
+ public void getMetrics(MetricsCollector metricsCollector, boolean all) {
+ MetricsRecordBuilder builder = metricsCollector.addRecord(SOURCE_NAME);
+ numBlockDeletionCommandSent.snapshot(builder, all);
+ numBlockDeletionCommandSuccess.snapshot(builder, all);
+ numBlockDeletionCommandFailure.snapshot(builder, all);
+ numBlockDeletionTransactionSent.snapshot(builder, all);
+ numBlockDeletionTransactionSuccess.snapshot(builder, all);
+ numBlockDeletionTransactionFailure.snapshot(builder, all);
+ numBlockDeletionTransactionCompleted.snapshot(builder, all);
+ numBlockDeletionTransactionCreated.snapshot(builder, all);
+ numSkippedTransactions.snapshot(builder, all);
+ numProcessedTransactions.snapshot(builder, all);
+ numBlockDeletionTransactionDataNodes.snapshot(builder, all);
+
+ MetricsRecordBuilder recordBuilder = builder;
+ for (Map.Entry<UUID, DatanodeCommandCounts> e :
numCommandsDatanode.entrySet()) {
+ recordBuilder = recordBuilder.endRecord().addRecord(SOURCE_NAME)
+ .add(new MetricsTag(Interns.info("datanode",
+ "Datanode host for deletion commands"), e.getKey().toString()))
+ .addGauge(DatanodeCommandCounts.COMMANDS_SENT_TO_DN,
+ e.getValue().getCommandsSent())
+ .addGauge(DatanodeCommandCounts.COMMANDS_SUCCESSFUL_EXECUTION_BY_DN,
+ e.getValue().getCommandsSuccess())
+ .addGauge(DatanodeCommandCounts.COMMANDS_FAILED_EXECUTION_BY_DN,
+ e.getValue().getCommandsFailure());
+ }
+ recordBuilder.endRecord();
+ }
+
+ /**
+ * Class contains metrics related to the ScmBlockDeletingService for each
datanode.
+ */
+ public static final class DatanodeCommandCounts {
+ private long commandsSent;
+ private long commandsSuccess;
+ private long commandsFailure;
+
+ private static final MetricsInfo COMMANDS_SENT_TO_DN = Interns.info(
+ "CommandsSent",
+ "Number of commands sent from SCM to the datanode for deletion");
+ private static final MetricsInfo COMMANDS_SUCCESSFUL_EXECUTION_BY_DN =
Interns.info(
+ "CommandsSuccess",
+ "Number of commands sent from SCM to the datanode for deletion for
which execution succeeded.");
+ private static final MetricsInfo COMMANDS_FAILED_EXECUTION_BY_DN =
Interns.info(
+ "CommandsFailed",
+ "Number of commands sent from SCM to the datanode for deletion for
which execution failed.");
+
+ public DatanodeCommandCounts() {
+ this.commandsSent = 0;
+ this.commandsSuccess = 0;
+ this.commandsFailure = 0;
+ }
+
+ public void incrCommandsSent(long delta) {
+ this.commandsSent += delta;
+ }
+
+ public void incrCommandsSuccess(long delta) {
+ this.commandsSuccess += delta;
+ }
+
+ public void incrCommandsFailure(long delta) {
+ this.commandsFailure += delta;
+ }
+
+ public long getCommandsSent() {
+ return commandsSent;
+ }
+
+ public long getCommandsSuccess() {
+ return commandsSuccess;
+ }
+
+ public long getCommandsFailure() {
+ return commandsFailure;
+ }
+
+ @Override
+ public String toString() {
+ return "Sent=" + commandsSent + ", Success=" + commandsSuccess + ",
Failed=" + commandsFailure;
+ }
+ }
+
+ public long getNumCommandsDatanodeSent() {
+ long sent = 0;
+ for (DatanodeCommandCounts v : numCommandsDatanode.values()) {
+ sent += v.commandsSent;
+ }
+ return sent;
+ }
+ public long getNumCommandsDatanodeSuccess() {
+ long sent = 0;
+ for (DatanodeCommandCounts v : numCommandsDatanode.values()) {
+ sent += v.commandsSuccess;
+ }
+ return sent;
+ }
+ public long getNumCommandsDatanodeFailed() {
+ long sent = 0;
Review Comment:
nit: `long failCount = 0;`
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/ScmBlockDeletingServiceMetrics.java:
##########
@@ -196,6 +226,116 @@ public long getNumBlockDeletionTransactionDataNodes() {
return numBlockDeletionTransactionDataNodes.value();
}
+ public Map<UUID, DatanodeCommandCounts> getNumCommandsDatanode() {
+ return numCommandsDatanode;
+ }
+
+ @Override
+ public void getMetrics(MetricsCollector metricsCollector, boolean all) {
+ MetricsRecordBuilder builder = metricsCollector.addRecord(SOURCE_NAME);
+ numBlockDeletionCommandSent.snapshot(builder, all);
+ numBlockDeletionCommandSuccess.snapshot(builder, all);
+ numBlockDeletionCommandFailure.snapshot(builder, all);
+ numBlockDeletionTransactionSent.snapshot(builder, all);
+ numBlockDeletionTransactionSuccess.snapshot(builder, all);
+ numBlockDeletionTransactionFailure.snapshot(builder, all);
+ numBlockDeletionTransactionCompleted.snapshot(builder, all);
+ numBlockDeletionTransactionCreated.snapshot(builder, all);
+ numSkippedTransactions.snapshot(builder, all);
+ numProcessedTransactions.snapshot(builder, all);
+ numBlockDeletionTransactionDataNodes.snapshot(builder, all);
+
+ MetricsRecordBuilder recordBuilder = builder;
+ for (Map.Entry<UUID, DatanodeCommandCounts> e :
numCommandsDatanode.entrySet()) {
+ recordBuilder = recordBuilder.endRecord().addRecord(SOURCE_NAME)
+ .add(new MetricsTag(Interns.info("datanode",
+ "Datanode host for deletion commands"), e.getKey().toString()))
+ .addGauge(DatanodeCommandCounts.COMMANDS_SENT_TO_DN,
+ e.getValue().getCommandsSent())
+ .addGauge(DatanodeCommandCounts.COMMANDS_SUCCESSFUL_EXECUTION_BY_DN,
+ e.getValue().getCommandsSuccess())
+ .addGauge(DatanodeCommandCounts.COMMANDS_FAILED_EXECUTION_BY_DN,
+ e.getValue().getCommandsFailure());
+ }
+ recordBuilder.endRecord();
+ }
+
+ /**
+ * Class contains metrics related to the ScmBlockDeletingService for each
datanode.
+ */
+ public static final class DatanodeCommandCounts {
+ private long commandsSent;
+ private long commandsSuccess;
+ private long commandsFailure;
+
+ private static final MetricsInfo COMMANDS_SENT_TO_DN = Interns.info(
+ "CommandsSent",
+ "Number of commands sent from SCM to the datanode for deletion");
+ private static final MetricsInfo COMMANDS_SUCCESSFUL_EXECUTION_BY_DN =
Interns.info(
+ "CommandsSuccess",
+ "Number of commands sent from SCM to the datanode for deletion for
which execution succeeded.");
+ private static final MetricsInfo COMMANDS_FAILED_EXECUTION_BY_DN =
Interns.info(
+ "CommandsFailed",
+ "Number of commands sent from SCM to the datanode for deletion for
which execution failed.");
+
+ public DatanodeCommandCounts() {
+ this.commandsSent = 0;
+ this.commandsSuccess = 0;
+ this.commandsFailure = 0;
+ }
+
+ public void incrCommandsSent(long delta) {
+ this.commandsSent += delta;
+ }
+
+ public void incrCommandsSuccess(long delta) {
+ this.commandsSuccess += delta;
+ }
+
+ public void incrCommandsFailure(long delta) {
+ this.commandsFailure += delta;
+ }
+
+ public long getCommandsSent() {
+ return commandsSent;
+ }
+
+ public long getCommandsSuccess() {
+ return commandsSuccess;
+ }
+
+ public long getCommandsFailure() {
+ return commandsFailure;
+ }
+
+ @Override
+ public String toString() {
+ return "Sent=" + commandsSent + ", Success=" + commandsSuccess + ",
Failed=" + commandsFailure;
+ }
+ }
+
+ public long getNumCommandsDatanodeSent() {
+ long sent = 0;
+ for (DatanodeCommandCounts v : numCommandsDatanode.values()) {
+ sent += v.commandsSent;
+ }
+ return sent;
+ }
+ public long getNumCommandsDatanodeSuccess() {
+ long sent = 0;
Review Comment:
nit: `long successCount = 0;`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]