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/08/04 03:26:32 UTC

[GitHub] [ozone] ChenSammi opened a new pull request #2493: Add metrics for ReplicationSupervisor

ChenSammi opened a new pull request #2493:
URL: https://github.com/apache/ozone/pull/2493


   https://issues.apache.org/jira/browse/HDDS-5536 


-- 
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


[GitHub] [ozone] jojochuang commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
jojochuang commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r684960899



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",
+        new ReplicationSupervisorMetrics(supervisor));
+  }
+
+  public void unRegister() {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    ms.unregisterSource(SOURCE);
+  }
+
+  @Override
+  @SuppressWarnings("SuspiciousMethodCalls")
+  public void getMetrics(MetricsCollector collector, boolean all) {
+    collector.addRecord(SOURCE)
+        .addGauge(Interns.info("numInFlightReplications",
+            "Number of pending replications(including queued replications"),
+            supervisor.getInFlightReplications())
+        .addGauge(Interns.info("numQueuedReplications",
+            "Number of replications in queue"),
+            supervisor.getQueueSize())
+        .addGauge(Interns.info("numRequestedReplications",
+            "Number of requested replications"),
+            supervisor.getReplicationRequestCount());
+  }

Review comment:
       ok. thanks for clarifying. no more questions.




-- 
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


[GitHub] [ozone] jojochuang commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
jojochuang commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r686454250



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       HDFS DataNodeMetrics.java
   dnName is host name + port. So yeah, it would be a good idea to try to make them unique.
   public static DataNodeMetrics create(Configuration conf, String dnName) {
       String sessionId = conf.get(DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY);
       MetricsSystem ms = DefaultMetricsSystem.instance();
       JvmMetrics jm = JvmMetrics.create("DataNode", sessionId, ms);
       String name = "DataNodeActivity-"+ (dnName.isEmpty()
           ? "UndefinedDataNodeName"+ ThreadLocalRandom.current().nextInt()
               : dnName.replace(':', '-'));
   
       // Percentile measurement is off by default, by watching no intervals
       int[] intervals = 
           conf.getInts(DFSConfigKeys.DFS_METRICS_PERCENTILES_INTERVALS_KEY);
       
       return ms.register(name, null, new DataNodeMetrics(name, sessionId,
           intervals, jm));
     }




-- 
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


[GitHub] [ozone] adoroszlai commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r724022786



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       @jojochuang can we commit this and file a follow-up task?




-- 
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


[GitHub] [ozone] ChenSammi commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
ChenSammi commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r688224940



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       I see.  @jojochuang , can we do it in a followup JIRA?  since other DN metrics also need be improved. 




-- 
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


[GitHub] [ozone] ChenSammi commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
ChenSammi commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r688224940



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       I see.  @jojochuang , can we do it in a followup JIRA?  since other DN metrics also need be improved. 




-- 
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


[GitHub] [ozone] ChenSammi commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
ChenSammi commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r724837760



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       Fired HDDS-5838 to track the comments. 




-- 
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


[GitHub] [ozone] ChenSammi commented on pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
ChenSammi commented on pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#issuecomment-938478180


   Thanks @jojochuang  and @adoroszlai  for the code review.


-- 
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


[GitHub] [ozone] jojochuang commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
jojochuang commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r685006222



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       Other than that the code looks good to me.




-- 
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


[GitHub] [ozone] adoroszlai commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r724022786



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       @jojochuang can we commit this and file a follow-up task?




-- 
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


[GitHub] [ozone] jojochuang commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
jojochuang commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r683905759



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",
+        new ReplicationSupervisorMetrics(supervisor));
+  }
+
+  public void unRegister() {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    ms.unregisterSource(SOURCE);
+  }
+
+  @Override
+  @SuppressWarnings("SuspiciousMethodCalls")
+  public void getMetrics(MetricsCollector collector, boolean all) {
+    collector.addRecord(SOURCE)
+        .addGauge(Interns.info("numInFlightReplications",
+            "Number of pending replications(including queued replications"),
+            supervisor.getInFlightReplications())
+        .addGauge(Interns.info("numQueuedReplications",
+            "Number of replications in queue"),
+            supervisor.getQueueSize())
+        .addGauge(Interns.info("numRequestedReplications",
+            "Number of requested replications"),
+            supervisor.getReplicationRequestCount());
+  }

Review comment:
       we should also add the number of successful and failed replications.
   @bshashikant do you remember what else we added during our internal test?




-- 
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


[GitHub] [ozone] jojochuang commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
jojochuang commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r683906115



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",
+        new ReplicationSupervisorMetrics(supervisor));
+  }
+
+  public void unRegister() {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    ms.unregisterSource(SOURCE);
+  }
+
+  @Override
+  @SuppressWarnings("SuspiciousMethodCalls")
+  public void getMetrics(MetricsCollector collector, boolean all) {
+    collector.addRecord(SOURCE)
+        .addGauge(Interns.info("numInFlightReplications",
+            "Number of pending replications(including queued replications"),
+            supervisor.getInFlightReplications())
+        .addGauge(Interns.info("numQueuedReplications",
+            "Number of replications in queue"),
+            supervisor.getQueueSize())
+        .addGauge(Interns.info("numRequestedReplications",
+            "Number of requested replications"),
+            supervisor.getReplicationRequestCount());
+  }

Review comment:
       (IIRC we also wanted to know how long does a replication take)




-- 
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


[GitHub] [ozone] jojochuang commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
jojochuang commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r684965384



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       we create and register one MetricsSystem per DN, which is not a problem for typical deployments.
   But i imagine it can potentially be problematic for unit tests because there are multiple DN objects in unit test heap and only one of them will successfully register.
   




-- 
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


[GitHub] [ozone] ChenSammi commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
ChenSammi commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r685731466



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       Yea,  that will be a "metrics already exists" warning in unit test, not only for this metrics, but also for other DN metries. 
   What's a general way to handle this?  Maybe we can append DN's  hostname+port  to each metrics source name?  
   I'm not sure how HDFS handle this. 
   
   




-- 
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


[GitHub] [ozone] ChenSammi commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
ChenSammi commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r683976989



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",
+        new ReplicationSupervisorMetrics(supervisor));
+  }
+
+  public void unRegister() {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    ms.unregisterSource(SOURCE);
+  }
+
+  @Override
+  @SuppressWarnings("SuspiciousMethodCalls")
+  public void getMetrics(MetricsCollector collector, boolean all) {
+    collector.addRecord(SOURCE)
+        .addGauge(Interns.info("numInFlightReplications",
+            "Number of pending replications(including queued replications"),
+            supervisor.getInFlightReplications())
+        .addGauge(Interns.info("numQueuedReplications",
+            "Number of replications in queue"),
+            supervisor.getQueueSize())
+        .addGauge(Interns.info("numRequestedReplications",
+            "Number of requested replications"),
+            supervisor.getReplicationRequestCount());
+  }

Review comment:
       successful and failed replications, and process time are provided by MeasuredReplicator. 
   
   This task is a supplement, mainly adding the queue size. Based on the queue size we can evaluate the pending workload of this Datanode.




-- 
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


[GitHub] [ozone] ChenSammi merged pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
ChenSammi merged pull request #2493:
URL: https://github.com/apache/ozone/pull/2493


   


-- 
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


[GitHub] [ozone] ChenSammi commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
ChenSammi commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r688224940



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       I see. Can we do it in a followup JIRA?  since other DN metrics also need be improved. 




-- 
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


[GitHub] [ozone] jojochuang commented on a change in pull request #2493: HDDS-5536. Add metrics for ReplicationSupervisor

Posted by GitBox <gi...@apache.org>.
jojochuang commented on a change in pull request #2493:
URL: https://github.com/apache/ozone/pull/2493#discussion_r686454399



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/replication/ReplicationSupervisorMetrics.java
##########
@@ -0,0 +1,72 @@
+/**
+ * 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.ozone.container.replication;
+
+import org.apache.hadoop.hdds.annotation.InterfaceAudience;
+import org.apache.hadoop.metrics2.MetricsCollector;
+import org.apache.hadoop.metrics2.MetricsSource;
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metrics;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.Interns;
+import org.apache.hadoop.ozone.OzoneConsts;
+
+/**
+ * Metrics source to report number of replication tasks.
+ */
+@InterfaceAudience.Private
+@Metrics(about = "Container Replication Supervisor Metrics",
+    context = OzoneConsts.OZONE)
+public class ReplicationSupervisorMetrics implements MetricsSource {
+
+  private static final String SOURCE =
+      ReplicationSupervisorMetrics.class.getSimpleName();
+  private final ReplicationSupervisor supervisor;
+
+  public ReplicationSupervisorMetrics(ReplicationSupervisor
+      replicationSupervisor) {
+    this.supervisor = replicationSupervisor;
+  }
+
+  public static ReplicationSupervisorMetrics create(ReplicationSupervisor
+      supervisor) {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE, "Container Replication Supervisor Metrics",

Review comment:
       https://github.com/apache/hadoop/blob/95454d821c6e4c08d49df195d7c1e0ea1aacafb9/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/metrics/DataNodeMetrics.java#L259




-- 
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