You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/07/26 08:18:42 UTC

[GitHub] [ozone] JacksonYao287 commented on a change in pull request #2382: HDDS-5401. Add more metrics to ReplicationManager to help monitor replication progress.

JacksonYao287 commented on a change in pull request #2382:
URL: https://github.com/apache/ozone/pull/2382#discussion_r676390238



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/ReplicationManagerMetrics.java
##########
@@ -0,0 +1,161 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership.  The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.hadoop.hdds.scm.container.replication;
+
+import org.apache.hadoop.hdds.scm.container.ReplicationManager;
+import org.apache.hadoop.metrics2.annotation.Metric;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.MutableCounterLong;
+import org.apache.hadoop.metrics2.lib.MutableGaugeLong;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Class contains metrics related to ReplicationManager.
+ */
+@Metrics(about = "Replication Manager Metrics", context = OzoneConsts.OZONE)
+public final class ReplicationManagerMetrics {
+
+  public static final String METRICS_SOURCE_NAME =
+      ReplicationManagerMetrics.class.getSimpleName();
+
+  @Metric("Tracked inflight container replication requests.")
+  private MutableGaugeLong inflightReplication;
+
+  @Metric("Tracked inflight container deletion requests.")
+  private MutableGaugeLong inflightDeletion;
+
+  @Metric("Tracked inflight container move requests.")
+  private MutableGaugeLong inflightMove;
+
+  @Metric("Number of replication commands sent.")
+  private MutableCounterLong numReplicationCmdsSent;
+
+  @Metric("Number of replication commands completed.")
+  private MutableCounterLong numReplicationCmdsCompleted;
+
+  @Metric("Number of replication commands timeout.")
+  private MutableCounterLong numReplicationCmdsTimeout;
+
+  @Metric("Number of deletion commands sent.")
+  private MutableCounterLong numDeletionCmdsSent;
+
+  @Metric("Number of deletion commands completed.")
+  private MutableCounterLong numDeletionCmdsCompleted;
+
+  @Metric("Number of deletion commands timeout.")
+  private MutableCounterLong numDeletionCmdsTimeout;
+
+  @Metric("Number of replication bytes total.")
+  private MutableCounterLong numReplicationBytesTotal;
+
+  @Metric("Number of replication bytes completed.")
+  private MutableCounterLong numReplicationBytesCompleted;
+
+  private ReplicationManager replicationManager;
+
+  public ReplicationManagerMetrics(ReplicationManager manager) {
+    this.replicationManager = manager;
+  }
+
+  public static ReplicationManagerMetrics create(ReplicationManager manager) {
+    return DefaultMetricsSystem.instance().register(METRICS_SOURCE_NAME,
+        "SCM Replication manager (closed container replication) related "
+            + "metrics",
+        new ReplicationManagerMetrics(manager));

Review comment:
       thanks for the work! NIT: if RM  start->stop->start, `ReplicationManagerMetrics#create` will be call twice ,and thus `new ReplicationManagerMetrics(manager)` will be called twice, it seems a little confuse to create the `ReplicationManagerMetrics ` twice. i think it is better off  using `register` instead of `create` for `ReplicationManagerMetrics`, and making ReplicationManagerMetrics singleton




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org